ServerHelper
final class ServerHelper (View source)
Exposes raw server parameters separately from trust-resolved request origin metadata.
The helper never consults global state and never reparses forwarding headers.
Methods
Binds raw server access and trusted origin access to one explicit request.
Returns one raw server parameter as text or the supplied fallback.
Reports whether one non-empty raw string server parameter is available.
Returns the raw server-parameter snapshot carried by the explicit PSR request.
Returns the allowlisted host or the explicit fallback when no host was trusted.
Returns the scheme established by the central request trust policy.
Reports whether the central request trust policy resolved HTTPS.
Returns the verified client address or the explicit fallback when unavailable.
Details
__construct
__construct(ServerRequestInterface $request, ResolvedRequestContext $context)
Binds raw server access and trusted origin access to one explicit request.
get
string
get(string $key, string $default = '')
Returns one raw server parameter as text or the supplied fallback.
has
bool
has(string $key)
Reports whether one non-empty raw string server parameter is available.
all
array
all()
Returns the raw server-parameter snapshot carried by the explicit PSR request.
host
string
host(string $default = 'localhost')
Returns the allowlisted host or the explicit fallback when no host was trusted.
scheme
string
scheme()
Returns the scheme established by the central request trust policy.
isHttps
bool
isHttps()
Reports whether the central request trust policy resolved HTTPS.
clientIp
string|null
clientIp(string|null $default = null)
Returns the verified client address or the explicit fallback when unavailable.