mini\Http\Message\ServerRequest
class
Documentation
Representation of an incoming, server-side HTTP request.
Per the HTTP specification, this interface includes properties for each of the following:
- Protocol version
- HTTP method
- URI
- Headers
- Message body
Additionally, it encapsulates all data as it has arrived at the application from the CGI and/or PHP environment, including:
- The values represented in $_SERVER.
- Any cookies provided (generally via $_COOKIE)
- Query string arguments (generally via $_GET, or as parsed via parse_str())
- Upload files, if any (as represented by $_FILES)
- Deserialized body parameters (generally from $_POST)
$_SERVER values MUST be treated as immutable, as they represent application state at the time of request; as such, no methods are provided to allow modification of those values. The other values provide such methods, as they can be restored from $_SERVER or the request body, and may need treatment during the application (e.g., body parameters may be deserialized based on content type).
Additionally, this interface recognizes the utility of introspecting a request to derive and match additional parameters (e.g., via URI path matching, decrypting cookie values, deserializing non-form-encoded body content, matching authorization headers to users, etc). These parameters are stored in an "attributes" property.
Requests are considered immutable; all methods that might change state MUST be implemented such that they retain the internal state of the current message and return an instance that contains the changed state.
Inheritance
Extends: mini\Http\Message\Request
Implements:
Psr\Http\Message\RequestInterface
Psr\Http\Message\MessageInterface
Psr\Http\Message\ServerRequestInterface
Uses Traits:
mini\Http\Message\ServerRequestTrait
Properties (13)
string $method
string $requestTarget
Psr\Http\Message\UriInterface $uriOverride
string $protocolVersion
Psr\Http\Message\StreamInterface $body
array $headers
array $headerCases
array $serverParams
array $cookieParams
array $queryParams
array $uploadedFiles
mixed $parsedBody
array $attributes
Methods (40)
Construct a ServerRequest instance.
public
static
create()
inherited from Http\Message\Request
Create a Request from a URI
Documentation missing
Configure the request.
Retrieves the message's request target.
Return an instance with the specific request-target.
Retrieves the HTTP method of the request.
Return an instance with the provided HTTP method.
Retrieves the URI instance with HTTPS detection from server params.
Returns an instance with the provided URI.
Get the query string from the request target.
Configure the message trait.
Retrieves the HTTP protocol version as a string.
Return an instance with the specified HTTP protocol version.
Get message headers
Checks if a header exists by the given case-insensitive name.
Retrieves a message header value by the given case-insensitive name.
Retrieves a comma-separated string of the values for a single header.
Return an instance with the provided value replacing the specified header.
Return an instance with the specified header appended with the given value.
Return an instance without the specified header.
Gets the body of the message.
Return an instance with the specified message body.
Construct a ServerRequest instance.
Retrieve server parameters.
Retrieve cookies.
Return an instance with the specified cookies.
Retrieve query string arguments.
Return an instance with the specified query string arguments.
Retrieve normalized file upload data.
Create a new instance with the specified uploaded files.
Retrieve any parameters provided in the request body.
Return an instance with the specified body parameters.
Retrieve attributes derived from the request.
Retrieve a single derived request attribute.
Return an instance with the specified derived request attribute.
Return an instance that removes the specified derived request attribute.
Validate an array as per the {@see self::withUploadedFiles()} function.
Documentation missing
Ensures that the passed query params adhere to the shape of