HttpRequestInspector
final class HttpRequestInspector (View source)
Derives logging and content-negotiation metadata without reparsing proxy trust inputs.
Constants
| private UNKNOWN |
|
Methods
Uses the request-scoped trust result when security-sensitive metadata is requested.
Returns the verified client address, or null outside an initialized HTTP request scope.
Masks the identifying suffix of the selected IPv4 or IPv6 client address.
Reports whether the verified immediate peer is an explicitly trusted proxy.
Returns the verified client address for proxied requests, or an empty string otherwise.
Returns the request user-agent header line.
Returns the request's standard referrer value when present.
Returns the allowlisted request host or an explicit unknown marker.
Returns the Accept header or an explicit unknown marker when it is absent.
Returns whether JSON is an explicitly preferred acceptable response representation.
Returns the raw Accept-Language header line.
Reports whether the request's encoding declaration contains gzip support.
Returns a numeric Content-Length value or zero for missing and invalid input.
Counts the request's parsed query parameters.
Counts parsed body parameters when the body representation is an array.
Resolves a request identifier from its header before consulting server parameters.
Hashes selected normalized request traits into a stable privacy-reduced fingerprint.
Details
__construct
__construct(ResolvedRequestContext|null $context = null)
Uses the request-scoped trust result when security-sensitive metadata is requested.
clientIp
string|null
clientIp(ServerRequestInterface $request)
Returns the verified client address, or null outside an initialized HTTP request scope.
anonymizedIp
string|null
anonymizedIp(ServerRequestInterface $request)
Masks the identifying suffix of the selected IPv4 or IPv6 client address.
viaProxy
bool
viaProxy(ServerRequestInterface $request)
Reports whether the verified immediate peer is an explicitly trusted proxy.
forwardedFor
string
forwardedFor(ServerRequestInterface $request)
Returns the verified client address for proxied requests, or an empty string otherwise.
userAgent
string
userAgent(ServerRequestInterface $request)
Returns the request user-agent header line.
referer
string|null
referer(ServerRequestInterface $request)
Returns the request's standard referrer value when present.
host
string
host(ServerRequestInterface $request)
Returns the allowlisted request host or an explicit unknown marker.
accept
string
accept(ServerRequestInterface $request)
Returns the Accept header or an explicit unknown marker when it is absent.
wantsJson
bool
wantsJson(ServerRequestInterface $request)
Returns whether JSON is an explicitly preferred acceptable response representation.
This inspects only the Accept header. It does not infer a response format from the request Content-Type, an AJAX header, or an Accept wildcard alone.
acceptLanguage
string
acceptLanguage(ServerRequestInterface $request)
Returns the raw Accept-Language header line.
gzipAccepted
bool
gzipAccepted(ServerRequestInterface $request)
Reports whether the request's encoding declaration contains gzip support.
contentLength
int
contentLength(ServerRequestInterface $request)
Returns a numeric Content-Length value or zero for missing and invalid input.
queryParamsCount
int
queryParamsCount(ServerRequestInterface $request)
Counts the request's parsed query parameters.
parsedBodyParamsCount
int
parsedBodyParamsCount(ServerRequestInterface $request)
Counts parsed body parameters when the body representation is an array.
requestId
string|null
requestId(ServerRequestInterface $request)
Resolves a request identifier from its header before consulting server parameters.
fingerprint
string
fingerprint(ServerRequestInterface $request)
Hashes selected normalized request traits into a stable privacy-reduced fingerprint.