PHP code example of joefallon / phpcsrf

1. Go to this page and download the library: Download joefallon/phpcsrf library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

joefallon / phpcsrf example snippets


$session = new Session();
$csrf = new CsrfGuard('form-name', $session);
$csrf->generateToken();

$session = new Session();
$csrf = new CsrfGuard('form-name', $session);
$csrf->isValidToken('55517f7944ee117160414b601a15e60e1076f5b4');