PHP code example of nuboxdevcom / psr15-csrf-middleware

1. Go to this page and download the library: Download nuboxdevcom/psr15-csrf-middleware 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/ */

    

nuboxdevcom / psr15-csrf-middleware example snippets


composer 

$middleware = new CsrfMiddleware($_SESSION, 200);
$app->pipe($middleware);

// Generate input
$input = "<input type='hidden' name='{$middleware->getFormKey()}' value='{$middleware->generateToken()}'/>"