PHP code example of hum2 / twig-form
1. Go to this page and download the library: Download hum2/twig-form 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/ */
hum2 / twig-form example snippets
composer
# validate
$factory = new \Aura\Session\SessionFactory;
$session = $factory->newInstance($_COOKIE);
$actualToken = $_POST['__csrf_value'];
if (!$session->getCsrfToken()->isValid($actualToken)) {
// csrf token error
}
// regenerate token(should be onetime token)
$session->getCsrfToken()->regenerateValue();