ValidateCsrfToken
class ValidateCsrfToken extends VerifyCsrfToken (View source)
Alias of VerifyCsrfToken for consistency.
Traits
| InteractsWithTime | |
| ExcludesPaths |
Properties
| protected Application | $app | The application instance. | from VerifyCsrfToken |
| protected Encrypter | $encrypter | The encrypter implementation. | from VerifyCsrfToken |
| protected array<int,string> | $except | The URIs that should be excluded. | from VerifyCsrfToken |
| static protected array | $neverVerify | The globally ignored URIs that should be excluded from CSRF verification. | from VerifyCsrfToken |
| protected bool | $addHttpCookie | Indicates whether the XSRF-TOKEN cookie should be set on the response. | from VerifyCsrfToken |
Methods
| int | secondsUntil(DateTimeInterface|DateInterval|int $delay)
Get the number of seconds until the given DateTime. | from InteractsWithTime |
| int | availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Get the "available at" UNIX timestamp. | from InteractsWithTime |
| DateTimeInterface|int | parseDateInterval(DateTimeInterface|DateInterval|int $delay)
If the given value is an interval, convert it to a DateTime instance. | from InteractsWithTime |
| int | currentTime()
Get the current system time as a UNIX timestamp. | from InteractsWithTime |
| string | runTimeForHumans(float $startTime, float $endTime = null)
Given a start time, format the total run time for human readability. | from InteractsWithTime |
| bool | inExceptArray(Request $request)
Determine if the request has a URI that should be excluded. | from ExcludesPaths |
| array | getExcludedPaths()
Get the URIs that should be excluded. | from ExcludesPaths |
| void | __construct(Application $app, Encrypter $encrypter)
Create a new middleware instance. | from VerifyCsrfToken |
| mixed | handle(Request $request, Closure $next)
Handle an incoming request. | from VerifyCsrfToken |
| bool | isReading(Request $request)
Determine if the HTTP request uses a ‘read’ verb. | from VerifyCsrfToken |
| bool | runningUnitTests()
Determine if the application is running unit tests. | from VerifyCsrfToken |
| bool | tokensMatch(Request $request)
Determine if the session and input CSRF tokens match. | from VerifyCsrfToken |
| string|null | getTokenFromRequest(Request $request)
Get the CSRF token from the request. | from VerifyCsrfToken |
| bool | shouldAddXsrfTokenCookie()
Determine if the cookie should be added to the response. | from VerifyCsrfToken |
| Response | addCookieToResponse(Request $request, Response $response)
Add the CSRF token to the response cookies. | from VerifyCsrfToken |
| Cookie | newCookie(Request $request, array $config)
Create a new "XSRF-TOKEN" cookie that contains the CSRF token. | from VerifyCsrfToken |
| static void | except(array|string $uris)
Indicate that the given URIs should be excluded from CSRF verification. | from VerifyCsrfToken |
| static bool | serialized()
Determine if the cookie contents should be serialized. | from VerifyCsrfToken |
| static void | flushState()
Flush the state of the middleware. | from VerifyCsrfToken |
Details
protected int secondsUntil(DateTimeInterface|DateInterval|int $delay)
Get the number of seconds until the given DateTime.
protected int availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Get the "available at" UNIX timestamp.
protected DateTimeInterface|int parseDateInterval(DateTimeInterface|DateInterval|int $delay)
If the given value is an interval, convert it to a DateTime instance.
protected int currentTime()
Get the current system time as a UNIX timestamp.
protected string runTimeForHumans(float $startTime, float $endTime = null)
Given a start time, format the total run time for human readability.
protected bool inExceptArray(Request $request)
Determine if the request has a URI that should be excluded.
array getExcludedPaths()
Get the URIs that should be excluded.
void __construct(Application $app, Encrypter $encrypter)
Create a new middleware instance.
protected bool isReading(Request $request)
Determine if the HTTP request uses a ‘read’ verb.
protected bool runningUnitTests()
Determine if the application is running unit tests.
protected bool tokensMatch(Request $request)
Determine if the session and input CSRF tokens match.
protected string|null getTokenFromRequest(Request $request)
Get the CSRF token from the request.
bool shouldAddXsrfTokenCookie()
Determine if the cookie should be added to the response.
protected Response addCookieToResponse(Request $request, Response $response)
Add the CSRF token to the response cookies.
protected Cookie newCookie(Request $request, array $config)
Create a new "XSRF-TOKEN" cookie that contains the CSRF token.
static void except(array|string $uris)
Indicate that the given URIs should be excluded from CSRF verification.
static bool serialized()
Determine if the cookie contents should be serialized.
static void flushState()
Flush the state of the middleware.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/11.x/Illuminate/Foundation/Http/Middleware/ValidateCsrfToken.html