-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Madeorsk edited this page May 24, 2020
·
1 revision
In the NoCSRF wiki, you can find the full documentation about the programming interface of NoCSRF library.
Here is the default code to use NoCSRF library:
use NoCSRF\NoCSRF;
// Creating a new NoCSRF instance, which manages anti-CSRF tokens.
$nocsrf = new NoCSRF();
// Get an anti-CSRF token (to add in a hidden input field or a request header).
$token = $nocsrf->getToken();
// Verify anti-CSRF token.
if ($nocsrf->verify($token))
echo "Anti-CSRF token is VALID!";
else
echo "Anti-CSRF token is INVALID.";