dev-master
9999999-devA quick and easy stateless CSRF protection for forms.
MIT
The Requires
by Islam Essam
jwt csrf
0.1.2
0.1.2.0A quick and easy stateless CSRF protection for forms.
MIT
The Requires
by Islam Essam
jwt csrf
Wallogit.com
2017 © Pedro Peláez
A quick and easy stateless CSRF protection for forms.
Quick CSRF offers stateless CSRF protection for forms that requires almost zero-configuration. It uses the JSON Web Token standard so it does not depend on session/cookies., (*2)
Quick CSRF depends on the beautiful lcobucci/jwt JWT implementation., (*3)
Edit your project's composer.json to require zoxta/csrf., (*4)
"require": {
"zoxta/csrf": "dev-master"
}
Then run composer update, (*5)
Just instantiate the class and you will be ready to go. You will also find an sample usage in the example directory., (*6)
isInvalid()) {
# return an error if CSRF token is invalid/expired
echo 'Invalid token, stop.
';
} else {
echo 'Valid token, process form.
';
}
exit;
}
````
You can also just use the `isValid()` method immediately without any other requirements.
````php
if ($CsrfToken->isValid()) {
# process the form request
echo 'Valid token, process form.
';
exit;
}
````
To echo the CSRFT token in your forms, you have two simple ways. You can either echo the token itself:
````html
Or you can echo the whole input field for simplicity using $CsrfToken->field() as the following:, (*7)
A quick and easy stateless CSRF protection for forms.
MIT
jwt csrf
A quick and easy stateless CSRF protection for forms.
MIT
jwt csrf