PHP code example of rhubarbphp / module-csrfprotection

1. Go to this page and download the library: Download rhubarbphp/module-csrfprotection 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/ */

    

rhubarbphp / module-csrfprotection example snippets


if ($request->server('REQUEST_METHOD') == 'POST'){
    CsrfProtection::singleton()->validateHeaders($request);
    CsrfProtection::singleton()->validateCookie($request);
}
 php
CsrfProtection::singleton()->validateHeaders($request);
 php
$request = Request::current();