class Forwarded (View source)

Constants

PARAM_BY

PARAM_FOR

PARAM_HOST

PARAM_PROTO

Methods

__construct(string|null $header = null, int $limit = 100, bool $fallback = true)

Constructor.

string|null
getParam(string $type, int $index = -1, mixed $alternative = null)

Returns a value from a specific Forwarded field.

array<int, array<string, string>>
getAll()

Returns all parsed Forwarded entries as an array.

Details

__construct(string|null $header = null, int $limit = 100, bool $fallback = true)

Constructor.

Parameters

string|null $header

Optional. raw "Forwarded" header value

int $limit

Optional. Limit forwarded blocks

bool $fallback

Optional. Whether to use "X-Forwarded-*" headers as fallback

string|null getParam(string $type, int $index = -1, mixed $alternative = null)

Returns a value from a specific Forwarded field.

Parameters

string $type

One of the PARAM_* constants: by, for, host, proto.

int $index

Optional index. Defaults to last (-1).

mixed $alternative

Value returned if not found.

Return Value

string|null

Exceptions

Exception

array<int, array<string, string>> getAll()

Returns all parsed Forwarded entries as an array.

Return Value

array<int, array<string, string>>