class Illuminate / Foundation / Http / Middleware / VerifyCsrfToken
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

VerifyCsrfToken

Uses

Properties

protected

$app Application

The application instance.

Default: null
protected

$encrypter Encrypter

The encrypter implementation.

Default: null
protected

$except array

The URIs that should be excluded from CSRF verification.

Default: []
protected

$addHttpCookie bool

Indicates whether the XSRF-TOKEN cookie should be set on the response.

Default: true

Methods

public

__construct ( Application $app , Encrypter $encrypter ) : void

Create a new middleware instance.

Parameters

public

handle ( $request , Closure $next ) : mixed

Handle an incoming request.

Parameters

protected

isReading ( $request ) : bool

Determine if the HTTP request uses a ‘read’ verb.

Parameters

protected

runningUnitTests ( ) : bool

Determine if the application is running unit tests.

protected

inExceptArray ( $request ) : bool

Determine if the request has a URI that should pass through CSRF verification.

Parameters

protected

tokensMatch ( $request ) : bool

Determine if the session and input CSRF tokens match.

Parameters

protected

getTokenFromRequest ( $request ) : string|null

Get the CSRF token from the request.

Parameters

public

shouldAddXsrfTokenCookie ( ) : bool

Determine if the cookie should be added to the response.

protected

addCookieToResponse ( $request , $response ) : Symfony\...\Response

Add the CSRF token to the response cookies.

Parameters

  • $request Request
  • $response Symfony\...\Response
protected

newCookie ( $request , $config ) : Symfony\...\Cookie

Create a new "XSRF-TOKEN" cookie that contains the CSRF token.

Parameters

public static

serialized ( ) : bool

Determine if the cookie contents should be serialized.