basteyy / plates-slim-csrf
用于使用 Slim 框架 CSRF 中间件的 Plates 扩展
0.0.1
2021-04-21 18:47 UTC
Requires
- slim/csrf: ^1.2.1
This package is auto-updated.
Last update: 2024-09-15 18:29:33 UTC
README
plates 扩展,用于使用 slim 框架中的 csrf 功能
安装
使用 composer 安装脚本
composer require basteyy/plates-slim-csrf
用法
<?php // 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();
许可
MIT 许可证(MIT)。请参阅 许可文件 获取更多信息。