humble / csrf
HUMBLE CSRF
dev-master
2016-10-18 10:53 UTC
Requires
- php: >=7.0.0
- humble/standards: ~1.0
- psr/http-message: ^1.0
Requires (Dev)
- phpunit/phpunit: ~5.2
This package is not auto-updated.
Last update: 2025-01-04 20:36:35 UTC
README
HUMBLE CSRF
- with PSR-7 CSRF Middleware
Install
Via Composer
$ composer require humble/csrf
Usage
Can be use with any PSR-7 project.
Get PHP CSRF with any $storage that implements \ArrayAccess interface.
$csrf = new \Humble\Csrf\Csrf($storage);
Use PHP CSRF with PSR-7 CSRF Middleware.
$middleware = new \Humble\Csrf\CsrfMiddleware($csrf);
$response = $middleware($request, $response, $next);
Get HTML snippet with CSRF token.
$snippet = $csrf->get();
<input type="hidden" name="CSRFName" value="%s">
<input type="hidden" name="CSRFToken" value="%s">
Validate CSRF token.
$csrf
License
The MIT License (MIT). Please see License File for more information.