Class for marshaling a request object from the current PHP environment.
More...
|
static | fromGlobals (array $server=null, array $query=null, array $body=null, array $cookies=null, array $files=null) |
| Create a request from the supplied superglobal values.
|
|
static | get ($key, array $values, $default=null) |
| Access a value in an array, returning a default value if not found.
|
|
static | getHeader ($header, array $headers, $default=null) |
| Search for a header value.
|
|
static | normalizeServer (array $server) |
| Marshal the $_SERVER array.
|
|
static | normalizeFiles (array $files) |
| Normalize uploaded files.
|
|
static | marshalHeaders (array $server) |
| Marshal headers from $_SERVER.
|
|
static | marshalUriFromServer (array $server, array $headers) |
| Marshal the URI from the $_SERVER array and headers.
|
|
static | marshalHostAndPortFromHeaders (stdClass $accumulator, array $server, array $headers) |
| Marshal the host and port from HTTP headers and/or the PHP environment.
|
|
static | marshalRequestUri (array $server) |
| Detect the base URI for the request.
|
|
static | stripQueryString ($path) |
| Strip the query string from a path.
|
|
Class for marshaling a request object from the current PHP environment.
Logic largely refactored from the ZF2 Zend class.
- Copyright
- Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) http://framework.zend.com/license/new-bsd New BSD License
static fromGlobals |
( |
array |
$server = null , |
|
|
array |
$query = null , |
|
|
array |
$body = null , |
|
|
array |
$cookies = null , |
|
|
array |
$files = null |
|
) |
| |
|
static |
Create a request from the supplied superglobal values.
If any argument is not supplied, the corresponding superglobal value will be used.
The ServerRequest created is then passed to the fromServer() method in order to marshal the request URI and headers.
- See Also
- fromServer()
- Parameters
-
array | $server | $_SERVER superglobal |
array | $query | $_GET superglobal |
array | $body | $_POST superglobal |
array | $cookies | $_COOKIE superglobal |
array | $files | $_FILES superglobal |
- Returns
- ServerRequest
- Exceptions
-
InvalidArgumentException | for invalid file values |
static get |
( |
|
$key, |
|
|
array |
$values, |
|
|
|
$default = null |
|
) |
| |
|
static |
Access a value in an array, returning a default value if not found.
Will also do a case-insensitive search if a case sensitive search fails.
- Parameters
-
string | $key | |
array | $values | |
mixed | $default | |
- Returns
- mixed
static getHeader |
( |
|
$header, |
|
|
array |
$headers, |
|
|
|
$default = null |
|
) |
| |
|
static |
Search for a header value.
Does a case-insensitive search for a matching header.
If found, it is returned as a string, using comma concatenation.
If not, the $default is returned.
- Parameters
-
string | $header | |
array | $headers | |
mixed | $default | |
- Returns
- string
static marshalHeaders |
( |
array |
$server | ) |
|
|
static |
Marshal headers from $_SERVER.
- Parameters
-
- Returns
- array
static marshalHostAndPortFromHeaders |
( |
stdClass |
$accumulator, |
|
|
array |
$server, |
|
|
array |
$headers |
|
) |
| |
|
static |
Marshal the host and port from HTTP headers and/or the PHP environment.
- Parameters
-
stdClass | $accumulator | |
array | $server | |
array | $headers | |
static marshalRequestUri |
( |
array |
$server | ) |
|
|
static |
Detect the base URI for the request.
Looks at a variety of criteria in order to attempt to autodetect a base URI, including rewrite URIs, proxy URIs, etc.
From ZF2's Zend class
- Copyright
- Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) http://framework.zend.com/license/new-bsd New BSD License
- Parameters
-
- Returns
- string
static marshalUriFromServer |
( |
array |
$server, |
|
|
array |
$headers |
|
) |
| |
|
static |
Marshal the URI from the $_SERVER array and headers.
- Parameters
-
array | $server | |
array | $headers | |
- Returns
- Uri
static normalizeFiles |
( |
array |
$files | ) |
|
|
static |
Normalize uploaded files.
Transforms each value into an UploadedFileInterface instance, and ensures that nested arrays are normalized.
- Parameters
-
- Returns
- array
- Exceptions
-
InvalidArgumentException | for unrecognized values |
static normalizeServer |
( |
array |
$server | ) |
|
|
static |
Marshal the $_SERVER array.
Pre-processes and returns the $_SERVER superglobal.
- Parameters
-
- Returns
- array
static stripQueryString |
( |
|
$path | ) |
|
|
static |
Strip the query string from a path.
- Parameters
-
- Returns
- string