mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 08:47:52 +00:00
[FEATURE] Support for custom csrf verifier
- Added support for custom csrf verifier. - Updated documentation.
This commit is contained in:
@@ -209,7 +209,27 @@ In the template we then call:
|
||||
|
||||
Result url is:
|
||||
|
||||
```/item/22?category=shoes ```
|
||||
```/item/22/?category=shoes```
|
||||
|
||||
## Custom CSRF verifier
|
||||
|
||||
Create a new class and extend the ```BaseCsrfVerifier``` middleware class provided with simple-php-router.
|
||||
|
||||
```php
|
||||
use Pecee\Http\Middleware\BaseCsrfVerifier;
|
||||
|
||||
class CsrfVerifier extends BaseCsrfVerifier {
|
||||
|
||||
protected $except = ['/companies/*', '/user/save'];
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Register the new class in your ```routes.php```, custom ```Router``` class or wherever you register your routes.
|
||||
|
||||
```php
|
||||
SimpleRouter::csrfVerifier(new \Demo\Middleware\CsrfVerifier());
|
||||
```
|
||||
|
||||
## Documentation
|
||||
While I work on a better documentation, please refer to the Laravel 5 routing documentation here:
|
||||
|
||||
Reference in New Issue
Block a user