korotovsky / csrf-validator-bundle
Validate CSRF token via annotation
Installs: 69 302
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 3
Forks: 2
Open Issues: 3
Type:symfony-bundle
Requires
- php: >=5.5
- doctrine/common: ~2.2
- symfony/config: >=2.5
- symfony/dependency-injection: >=2.5
- symfony/event-dispatcher: >=2.5
- symfony/http-foundation: >=2.5
- symfony/http-kernel: >=2.5
- symfony/security-csrf: >=2.5
This package is not auto-updated.
Last update: 2024-10-18 21:44:32 UTC
README
- PHP
>=5.5
- KrtvCsrfValidatorBundle's
0.4.x
compatible with symfony (>=2.7
versions). - Doctrine is required
Features:
- Add extra annotation for auto validation CSRF-tokens to your controller actions
Installation and configuration:
Pretty simple with Composer, add:
{ "require": { "korotovsky/csrf-validator-bundle": "0.4.*" } }
For latest version (UNSTABLE) use
{ "require": { "korotovsky/csrf-validator-bundle": "~0.4.0@dev" } }
Configuration example
- No specific configuration is needed!
Add KrtvCsrfValidatorBundle to your application kernel
// app/AppKernel.php public function registerBundles() { return array( // ... new Krtv\Bundle\CsrfValidatorBundle\KrtvCsrfValidatorBundle(), // ... ); }
Usage examples:
Just add annotation to your controller action
// Acme\MainBundle\Controller\DefaultController.php use Krtv\Bundle\CsrfValidatorBundle\Annotations as Krtv; /** * @Krtv\Csrf(intention="your_intention") * @return Response */ public function importantZoneAction() { // some code here ... return new Response(); }
View
<a href="{{ path('_some_route', {'token': csrf_token('your_intention')}) }}">Subscribe!</a>