CorsConfig
in package
FinalYes
Immutable config DTO for the CORS middleware (`CorsTrait`).
allowedOrigins is a list of exact-match origins (e.g. https://app.example.com) or the
special * (wildcard, dev only). IMPORTANT: a wildcard must not be combined with credentials,
because the browser ignores Allow-Credentials together with *.
Table of Contents
Properties
- $allowCredentials : bool
- $allowedHeaders : array<string|int, mixed>
- $allowedMethods : array<string|int, mixed>
- $allowedOrigins : array<string|int, mixed>
- $exposedHeaders : array<string|int, mixed>
- $maxAge : int
Methods
- __construct() : mixed
- isOriginAllowed() : bool
- isWildcard() : bool
Properties
$allowCredentials read-only
public
bool
$allowCredentials
$allowedHeaders read-only
public
array<string|int, mixed>
$allowedHeaders
$allowedMethods read-only
public
array<string|int, mixed>
$allowedMethods
$allowedOrigins read-only
public
array<string|int, mixed>
$allowedOrigins
$exposedHeaders read-only
public
array<string|int, mixed>
$exposedHeaders
$maxAge read-only
public
int
$maxAge
Methods
__construct()
public
__construct(array<string|int, string> $allowedOrigins, array<string|int, string> $allowedMethods, array<string|int, string> $allowedHeaders, array<string|int, string> $exposedHeaders, bool $allowCredentials, int $maxAge) : mixed
Parameters
- $allowedOrigins : array<string|int, string>
- $allowedMethods : array<string|int, string>
- $allowedHeaders : array<string|int, string>
- $exposedHeaders : array<string|int, string>
- $allowCredentials : bool
- $maxAge : int
isOriginAllowed()
public
isOriginAllowed(string $origin) : bool
Parameters
- $origin : string
Return values
boolisWildcard()
public
isWildcard() : bool