Documentation

VerifyCsrfToken
in package
Uses InteractsWithTime

Table of Contents

$app  : Application
The application instance.
$encrypter  : Encrypter
The encrypter implementation.
$except  : array<string|int, mixed>
The URIs that should be excluded from CSRF verification.
__construct()  : void
Create a new middleware instance.
handle()  : mixed
Handle an incoming request.
serialized()  : bool
Determine if the cookie contents should be serialized.
addCookieToResponse()  : Response
Add the CSRF token to the response cookies.
availableAt()  : int
Get the "available at" UNIX timestamp.
currentTime()  : int
Get the current system time as a UNIX timestamp.
getTokenFromRequest()  : string
Get the CSRF token from the request.
inExceptArray()  : bool
Determine if the request has a URI that should pass through CSRF verification.
isReading()  : bool
Determine if the HTTP request uses a ‘read’ verb.
parseDateInterval()  : DateTimeInterface|int
If the given value is an interval, convert it to a DateTime instance.
runningUnitTests()  : bool
Determine if the application is running unit tests.
secondsUntil()  : int
Get the number of seconds until the given DateTime.
tokensMatch()  : bool
Determine if the session and input CSRF tokens match.

Properties

$except

The URIs that should be excluded from CSRF verification.

protected array<string|int, mixed> $except = []

Methods

serialized()

Determine if the cookie contents should be serialized.

public static serialized() : bool
Return values
bool

availableAt()

Get the "available at" UNIX timestamp.

protected availableAt(DateTimeInterface|DateInterval|int $delay) : int
Parameters
$delay : DateTimeInterface|DateInterval|int
Return values
int

currentTime()

Get the current system time as a UNIX timestamp.

protected currentTime() : int
Return values
int

getTokenFromRequest()

Get the CSRF token from the request.

protected getTokenFromRequest(Request $request) : string
Parameters
$request : Request
Return values
string

inExceptArray()

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

protected inExceptArray(Request $request) : bool
Parameters
$request : Request
Return values
bool

isReading()

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

protected isReading(Request $request) : bool
Parameters
$request : Request
Return values
bool

parseDateInterval()

If the given value is an interval, convert it to a DateTime instance.

protected parseDateInterval(DateTimeInterface|DateInterval|int $delay) : DateTimeInterface|int
Parameters
$delay : DateTimeInterface|DateInterval|int
Return values
DateTimeInterface|int

runningUnitTests()

Determine if the application is running unit tests.

protected runningUnitTests() : bool
Return values
bool

secondsUntil()

Get the number of seconds until the given DateTime.

protected secondsUntil(DateTimeInterface|DateInterval|int $delay) : int
Parameters
$delay : DateTimeInterface|DateInterval|int
Return values
int

tokensMatch()

Determine if the session and input CSRF tokens match.

protected tokensMatch(Request $request) : bool
Parameters
$request : Request
Return values
bool

Search results