zendframework/zf2 — pull request #663 by EvanDotPro (2011-12-14 20:33:58+00:00)
Title: Add a view helper for generating CSRF token inputs for forms not rendered by Zend\Form

- Uses Zend\Form\Element\Hash
- Updated Zend\Form\Element\Hash to keep an internal cache of the generated tokens in a given request so that later instances of the same form (or different form with the same name CSRF field) will not invalidate earlier CSRF tokens.
- Updated and added unit tests.

Usage (in your view):

formcsrf(); ?>

or specify the name to use for the input element:

formcsrf('token'); ?>