cblanquera / cradle-csrf
dev-master
2018-03-12 06:57 UTC
Requires
- cradlephp/framework: ~1.1.1
Requires (Dev)
- phpunit/phpunit: 5.7.9
- satooshi/php-coveralls: ^1.0
- squizlabs/php_codesniffer: 2.7.1
This package is auto-updated.
Last update: 2022-02-01 13:00:42 UTC
README
弃用通知:该项目已迁移至https://github.com/CradlePHP/cradle-csrf
cradle-csrf
Cradle的CSRF处理
1. 要求
您应正在使用CradlePHP的dev-master
版本。更多信息请访问https://cradlephp.github.io/。
2. 安装
composer require cblanquera/cradle-csrf
然后在/bootstrap.php
中添加:
->register('cblanquera/cradle-csrf')
3. 配方
一旦数据库安装完毕,打开/public/index.php
并添加以下内容。
<?php
use Cradle\Framework\Flow;
return cradle()
//add routes here
->get('/csrf/test', 'CSRF Page')
->post('/csrf/test', 'CSRF Process')
//add flows here
//renders a table display
->flow('CSRF Page',
Flow::csrf()->load,
Flow::csrf()->render,
'TODO: form page'
)
->flow('CSRF Process',
Flow::csrf()->check,
array(
Flow::csrf()->yes,
'TODO: process'
),
array(
Flow::csrf()->no,
'TODO: deny'
)
);