final class ServerBag (View source)

Preserves the server-bag API while delegating trusted values to the central request policy.

Methods

Binds the bag to one request-scoped server helper.

array
all()

Returns the raw server-parameter snapshot from the explicit PSR request.

array
mixed
get(string $key, mixed $default = null)

Returns one raw server parameter or the supplied fallback when absent.

mixed
string
host(string $default = 'localhost')

Returns the allowlisted host or the explicit fallback when no host was trusted.

string
string
scheme()

Returns the scheme established by the central request trust policy.

string
string|null
ip(string|null $default = null)

Returns the verified client address or the explicit fallback when unavailable.

string|null

Details

__construct

__construct(ServerHelper $server)

Binds the bag to one request-scoped server helper.

Parameters

ServerHelper $server

all

array all()

Returns the raw server-parameter snapshot from the explicit PSR request.

Return Value

array

get

mixed get(string $key, mixed $default = null)

Returns one raw server parameter or the supplied fallback when absent.

Parameters

string $key
mixed $default

Return Value

mixed

host

string host(string $default = 'localhost')

Returns the allowlisted host or the explicit fallback when no host was trusted.

Parameters

string $default

Return Value

string

scheme

string scheme()

Returns the scheme established by the central request trust policy.

Return Value

string

ip

string|null ip(string|null $default = null)

Returns the verified client address or the explicit fallback when unavailable.

Parameters

string|null $default

Return Value

string|null