CsrfViewHelper
final class CsrfViewHelper (View source)
Exposes session-backed CSRF tokens and escaped hidden fields to templates.
Methods
__construct(CsrfTokenManager $tokens)
Connects template operations to the canonical token manager.
token(string $name = 'default')
Returns the stable session token associated with the requested logical name.
string
field(string $name = 'default')
Renders an escaped hidden input containing the requested session token.
string
Returns the public form field name recognized by the CSRF middleware.
string
Details
__construct
__construct(CsrfTokenManager $tokens)
Connects template operations to the canonical token manager.
token
string
token(string $name = 'default')
Returns the stable session token associated with the requested logical name.
field
string
field(string $name = 'default')
Renders an escaped hidden input containing the requested session token.
fieldName
string
fieldName()
Returns the public form field name recognized by the CSRF middleware.