RequestInformationHelper
abstract class RequestInformationHelper (View source)
Helper to extract various information from PSR-7 requests.
Methods
Returns the relative path (i.e. relative to the web root) and name of the script as it was accessed through the web server.
Returns the relative path (i.e. relative to the web root) to the script as it was accessed through the web server.
Constructs a relative path for this request, that is the path segments left after removing the baseUri.
Tries to detect the base URI of request.
Return the Request-Line of this Request Message, consisting of the method, the URI and the HTTP version Would be, for example, "GET /foo?bar=baz HTTP/1.1" Note that the URI part is, at the moment, only possible in the form "abs_path" since the actual requestUri of the Request cannot be determined during the creation of the Request.
Renders information about the request
Renders the HTTP headers - EXCLUDING the status header - of the given request
Extract the charset from the content type header if available
Extract header key/value pairs from a $_SERVER array.
Details
static string
getScriptRequestPathAndFilename(RequestInterface $request)
Returns the relative path (i.e. relative to the web root) and name of the script as it was accessed through the web server.
static string
getScriptRequestPath(RequestInterface $request)
Returns the relative path (i.e. relative to the web root) to the script as it was accessed through the web server.
static string
getRelativeRequestPath(RequestInterface $request)
Constructs a relative path for this request, that is the path segments left after removing the baseUri.
static UriInterface
generateBaseUri(RequestInterface $request)
Tries to detect the base URI of request.
static string
generateRequestLine(RequestInterface $request)
Return the Request-Line of this Request Message, consisting of the method, the URI and the HTTP version Would be, for example, "GET /foo?bar=baz HTTP/1.1" Note that the URI part is, at the moment, only possible in the form "abs_path" since the actual requestUri of the Request cannot be determined during the creation of the Request.
static string
renderRequestInformation(RequestInterface $request)
Renders information about the request
static string
renderRequestHeaders(RequestInterface $request)
Renders the HTTP headers - EXCLUDING the status header - of the given request
static string
getContentCharset(RequestInterface $request)
Extract the charset from the content type header if available
static array
extractHeadersFromServerVariables(array $server)
Extract header key/value pairs from a $_SERVER array.