treehousetim / xcsrf
Zero dependency Cross Site Request Forgery Protection
0.0.1
2022-02-21 20:04 UTC
Requires
- php: ^7.0 || ^8.0
Requires (Dev)
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2025-01-22 02:55:38 UTC
README
treehousetim/xcsrf
A library to enable simple cross site request forgery blocking
Installing
composer require treehousetim/xcsrf
Using
<?php namespace App\Controllers; use treehousetim\xcsrf\xcsrf; if( $_POST ) { xcsrf::getInstance()->protect(); // process POST request here. } echo '<form>'; echo '<input type="hidden" value="' . xcsrf::getInstance()->getCode() . '"></input>'; echo '<input type="submit" value="Submit"></input>'; echo '</form>';