Server-side HTTP request
Extends the Request definition to add methods for accessing incoming data,
specifically server parameters, cookies, matched path parameters, query
string arguments, body parameters, and upload file information.
"Attributes" are discovered via decomposing the request (and usually
specifically the URI path), and typically will be injected by the application.
Requests are considered immutable; all methods that might change state are
implemented such that they retain the internal state of the current
message and return a new instance that contains the changed state.
- Extends
- Implements
Psr\Http\Message\MessageInterface Psr\Http\Message\RequestInterface Psr\Http\Message\ServerRequestInterface - Traits
Methods |
public __construct(string $method, $uri, array $headers = [], $body = NULL, string $version = '1.1', array $serverParams = [])
|
public static fromGlobals() : Psr\Http\Message\ServerRequestInterface Return a ServerRequest populated with superglobals: |
public getAttribute( $attribute, $default = NULL)
|
public getAttributes() : array |
public getCookieParams() : array |
public getParsedBody()
|
public getQueryParams() : array |
public getServerParams() : array |
public getUploadedFiles() : array |
public static getUriFromGlobals() : Psr\Http\Message\UriInterface Get a Uri populated with values from $_SERVER. |
public static normalizeFiles(array $files) : array Return an UploadedFile instance array.
|
public withAttribute( $attribute, $value) : Psr\Http\Message\ServerRequestInterface |
public withCookieParams(array $cookies) : Psr\Http\Message\ServerRequestInterface |
public withoutAttribute( $attribute) : Psr\Http\Message\ServerRequestInterface |
public withParsedBody( $data) : Psr\Http\Message\ServerRequestInterface |
public withQueryParams(array $query) : Psr\Http\Message\ServerRequestInterface |
public withUploadedFiles(array $uploadedFiles) : Psr\Http\Message\ServerRequestInterface |
Properties |
private $attributes = []
|
private $cookieParams = []
|
private $parsedBody = NULL
|
private $queryParams = []
|
private $serverParams = NULL
|
private $uploadedFiles = []
|
Methods |
private static createUploadedFileFromSpec(array $value) Create and return an UploadedFile instance from a $_FILES specification. If the specification represents an array of values, this method will
|
private static extractHostAndPortFromAuthority(string $authority) : array |
private static normalizeNestedFileSpec(array $files = []) : array Normalize an array of file specifications. Loops through all nested files and returns a normalized array of
|
Methods |
private static createUploadedFileFromSpec(array $value) Create and return an UploadedFile instance from a $_FILES specification. If the specification represents an array of values, this method will
|
private static extractHostAndPortFromAuthority(string $authority) : array |
public static fromGlobals() : Psr\Http\Message\ServerRequestInterface Return a ServerRequest populated with superglobals: |
public static getUriFromGlobals() : Psr\Http\Message\UriInterface Get a Uri populated with values from $_SERVER. |
public static normalizeFiles(array $files) : array Return an UploadedFile instance array.
|
private static normalizeNestedFileSpec(array $files = []) : array Normalize an array of file specifications. Loops through all nested files and returns a normalized array of
|