PHP code example of basteyy / plates-slim-csrf
1. Go to this page and download the library: Download basteyy/plates-slim-csrf 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/ */
basteyy / plates-slim-csrf example snippets
// Add Csrf to your app according to the documentation here: https://github.com/slimphp/Slim-Csrf
$container->set('csrf', function () use ($responseFactory) {
return new \Slim\Csrf\Guard($responseFactory);
});
// Add the plates like the documentation here: https://platesphp.com/engine/extensions/
$templates = new League\Plates\Engine('/path/to/templates');
// Add the extension to plates and forwad the csrf GuardClass:
$templates->loadExtension(new \basteyy\PlatesSlimCsrf\PlatesSlimCsrf($container->get('csrf')));
// Inside your form use echo the following:
echo $this->getCsrf();