hum2 / twig-form
Form Extension for Twig.
Installs: 6 182
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.2.4
- aura/session: ~2.0
- twig/twig: ~1.0
Requires (Dev)
- phpspec/phpspec: ~2.2
This package is not auto-updated.
Last update: 2025-03-29 21:00:54 UTC
README
install
composer require hum2/twig-form
How To Use
index.html.twig
{% form(action=post_url|e, method="POST", enctype="multipart/form-data") %} <input type="text" name="keyword" /> {% endform %}
index.php
# validate $factory = new \Aura\Session\SessionFactory; $session = $factory->newInstance($_COOKIE); $actualToken = $_POST['__csrf_value']; if (!$session->getCsrfToken()->isValid($actualToken)) { // csrf token error } // regenerate token(should be onetime token) $session->getCsrfToken()->regenerateValue();
dependency Package
- twig/twig
- aura/session