final class CorsConfigDefinition extends AbstractConfigDefinition (View source)

Builds one composable layer of cross-origin resource sharing configuration.

Properties

protected mixed[] $data from  AbstractConfigDefinition

Methods

set(string $path, mixed $value)

Replaces one configuration value at a dot-separated path.

append(string $path, mixed $value)

Appends one configuration value at a dot-separated list path.

create()

Creates an empty definition that contributes only explicitly configured values.

static string

Returns the registry key under which CORS definitions are collected.

string
enabled(bool $enabled = true)

Sets whether CORS processing participates in the HTTP pipeline.

Disables CORS processing for this definition layer.

allowedOrigins(array $origins)

Replaces the allowed origin values contributed by this layer.

allowedMethods(array $methods)

Replaces the allowed preflight method values contributed by this layer.

allowedHeaders(array $headers)

Replaces the allowed preflight header values contributed by this layer.

exposedHeaders(array $headers)

Replaces the response headers exposed to cross-origin clients.

allowCredentials(bool $allowCredentials = true)

Sets whether cross-origin responses may expose credentials.

maxAge(int|null $maxAge)

Sets the browser preflight cache lifetime, or clears it with null.

Details

toArray

No description

Return Value

array

fromArrayData

final static AbstractConfigDefinition fromArrayData(array $data)

No description

Parameters

array $data

Return Value

AbstractConfigDefinition

set

protected AbstractConfigDefinition set(string $path, mixed $value)

Replaces one configuration value at a dot-separated path.

Parameters

string $path
mixed $value

Return Value

AbstractConfigDefinition

append

protected AbstractConfigDefinition append(string $path, mixed $value)

Appends one configuration value at a dot-separated list path.

Parameters

string $path
mixed $value

Return Value

AbstractConfigDefinition

create

Creates an empty definition that contributes only explicitly configured values.

Return Value

CorsConfigDefinition

moduleKey

static string moduleKey()

Returns the registry key under which CORS definitions are collected.

Return Value

string

enabled

CorsConfigDefinition enabled(bool $enabled = true)

Sets whether CORS processing participates in the HTTP pipeline.

Parameters

bool $enabled

Return Value

CorsConfigDefinition

disabled

Disables CORS processing for this definition layer.

Return Value

CorsConfigDefinition

allowedOrigins

CorsConfigDefinition allowedOrigins(array $origins)

Replaces the allowed origin values contributed by this layer.

Parameters

array $origins

Return Value

CorsConfigDefinition

allowedMethods

CorsConfigDefinition allowedMethods(array $methods)

Replaces the allowed preflight method values contributed by this layer.

Parameters

array $methods

Return Value

CorsConfigDefinition

allowedHeaders

CorsConfigDefinition allowedHeaders(array $headers)

Replaces the allowed preflight header values contributed by this layer.

Parameters

array $headers

Return Value

CorsConfigDefinition

exposedHeaders

CorsConfigDefinition exposedHeaders(array $headers)

Replaces the response headers exposed to cross-origin clients.

Parameters

array $headers

Return Value

CorsConfigDefinition

allowCredentials

CorsConfigDefinition allowCredentials(bool $allowCredentials = true)

Sets whether cross-origin responses may expose credentials.

Parameters

bool $allowCredentials

Return Value

CorsConfigDefinition

maxAge

CorsConfigDefinition maxAge(int|null $maxAge)

Sets the browser preflight cache lifetime, or clears it with null.

Parameters

int|null $maxAge

Return Value

CorsConfigDefinition