Installation
With Composer
composer require atomastic/csrf
Usage
use Atomastic\Csrf\Csrf;
// Start PHP session
session_start();
/**
* Create the csrf object.
*
* @param string $tokenNamePrefix Prefix for CSRF token name.
* @param string $tokenValuePrefix Prefix for CSRF token value.
* @param int $strength Strength.
*
* @throws CsrfException
*/
$csrf = new Csrf('__csrf_name',
'__csrf_value',
32);
Edit this page on GitHub
Getting Started
Methods
- getTokenName Get token name.
- getTokenValue Get token value.
- isValid Checks whether an incoming CSRF token name and value is valid.