Documentation

CSRF
in package

Table of Contents

ALLOWED_SITES  = [ // Allow only requests from the same origin or without a browser (curl, Postman, etc.) "same-origin" => ["same-origin", "none"], // Allow requests from the same origin, subdomains and without a browser "same-site" => ["same-origin", "same-site", "none"], // Allow every site, only csrf_blocked_origins still rejects "any" => ["same-origin", "same-site", "cross-site", "none"], ]
SAFE_METHODS  = ["GET", "HEAD", "OPTIONS"]
verify()  : bool
Checks the current request against the csrf_* settings.
parseConfigList()  : array<string|int, string>

Constants

ALLOWED_SITES

private mixed ALLOWED_SITES = [ // Allow only requests from the same origin or without a browser (curl, Postman, etc.) "same-origin" => ["same-origin", "none"], // Allow requests from the same origin, subdomains and without a browser "same-site" => ["same-origin", "same-site", "none"], // Allow every site, only csrf_blocked_origins still rejects "any" => ["same-origin", "same-site", "cross-site", "none"], ]

SAFE_METHODS

private mixed SAFE_METHODS = ["GET", "HEAD", "OPTIONS"]

Methods

verify()

Checks the current request against the csrf_* settings.

public static verify(string ...$additionalMethods) : bool
Parameters
$additionalMethods : string

Methods to remove from the safe-method exemption for this call, e.g. "GET", so they get CSRF-checked too

Return values
bool —

Whether the request is verified

parseConfigList()

private static parseConfigList(string $key) : array<string|int, string>
Parameters
$key : string
Return values
array<string|int, string> —

The lowercase, trimmed and non-empty entries of a comma separated setting

Search results