ViewHelper Documentation


ViewHelper that outputs a CSRF token which is required for "unsafe" requests (e.g. POST, PUT, DELETE, ...).

Note: You won't need this ViewHelper if you use the Form ViewHelper, because that creates a hidden field with the CSRF token for unsafe requests automatically. This ViewHelper is mainly useful in conjunction with AJAX.

= Examples =


Now, the CSRF token can be extracted via JavaScript to be appended to requests, for example with jQuery: jQuery (exemplary): $.ajax({ url: '', type: 'POST', data: {

__csrfToken: $('#someDiv').attr('data-csrf-token')

} });


This ViewHelper has no arguments

ViewHelper Resources

Schema Resources