Copied!

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.

Cloneable Instantiable
Methods
public __construct ( $method , $uri , array $headers = [ ] , $body = NULL , $version = '1.1' , array $serverParams = [ ] )
 
public static fromGlobals ()
 

Return a ServerRequest populated with superglobals:
$_GET
$_POST
$_COOKIE
$_FILES
$_SERVER

  • return ServerRequestInterface
public getAttribute ( $attribute , $default = NULL )
 

{@inheritdoc}

public getAttributes ()
 

{@inheritdoc}

public GuzzleHttp\Psr7\Request :: getBody ()
public getCookieParams ()
 

{@inheritdoc}

public GuzzleHttp\Psr7\Request :: getHeader ( $header )
public GuzzleHttp\Psr7\Request :: getHeaderLine ( $header )
public GuzzleHttp\Psr7\Request :: getHeaders ()
public GuzzleHttp\Psr7\Request :: getMethod ()
public getParsedBody ()
 

{@inheritdoc}

public GuzzleHttp\Psr7\Request :: getProtocolVersion ()
public getQueryParams ()
 

{@inheritdoc}

public GuzzleHttp\Psr7\Request :: getRequestTarget ()
public getServerParams ()
 

{@inheritdoc}

public getUploadedFiles ()
 

{@inheritdoc}

public GuzzleHttp\Psr7\Request :: getUri ()
public static getUriFromGlobals ()
 

Get a Uri populated with values from $_SERVER.

  • return UriInterface
public GuzzleHttp\Psr7\Request :: hasHeader ( $header )
public static normalizeFiles ( array $files )
 

Return an UploadedFile instance array.

  • return array
  • throws InvalidArgumentException for unrecognized values
public GuzzleHttp\Psr7\Request :: withAddedHeader ( $header , $value )
public withAttribute ( $attribute , $value )
 

{@inheritdoc}

public GuzzleHttp\Psr7\Request :: withBody ( Psr\Http\Message\StreamInterface $body )
public withCookieParams ( array $cookies )
 

{@inheritdoc}

public GuzzleHttp\Psr7\Request :: withHeader ( $header , $value )
public GuzzleHttp\Psr7\Request :: withMethod ( $method )
public withoutAttribute ( $attribute )
 

{@inheritdoc}

public GuzzleHttp\Psr7\Request :: withoutHeader ( $header )
public withParsedBody ( $data )
 

{@inheritdoc}

public GuzzleHttp\Psr7\Request :: withProtocolVersion ( $version )
public withQueryParams ( array $query )
 

{@inheritdoc}

public GuzzleHttp\Psr7\Request :: withRequestTarget ( $requestTarget )
public withUploadedFiles ( array $uploadedFiles )
 

{@inheritdoc}

public GuzzleHttp\Psr7\Request :: withUri ( Psr\Http\Message\UriInterface $uri , $preserveHost = false )
Properties
private $attributes
 
  • var array
private $cookieParams
 
  • var array
private $parsedBody
 
  • var null | array | object
private $queryParams
 
  • var array
private $serverParams
 
  • var array
private $uploadedFiles
 
  • var array
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
delegate to normalizeNestedFileSpec() and return that return value.

  • return array | UploadedFileInterface
private static extractHostAndPortFromAuthority ( $authority )
private static normalizeNestedFileSpec ( array $files = [ ] )
 

Normalize an array of file specifications.

Loops through all nested files and returns a normalized array of
UploadedFileInterface instances.

  • return UploadedFileInterface []
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
delegate to normalizeNestedFileSpec() and return that return value.

  • return array | UploadedFileInterface
private static extractHostAndPortFromAuthority ( $authority )
public static fromGlobals ()
 

Return a ServerRequest populated with superglobals:
$_GET
$_POST
$_COOKIE
$_FILES
$_SERVER

  • return ServerRequestInterface
public static getUriFromGlobals ()
 

Get a Uri populated with values from $_SERVER.

  • return UriInterface
public static normalizeFiles ( array $files )
 

Return an UploadedFile instance array.

  • return array
  • throws InvalidArgumentException for unrecognized values
private static normalizeNestedFileSpec ( array $files = [ ] )
 

Normalize an array of file specifications.

Loops through all nested files and returns a normalized array of
UploadedFileInterface instances.

  • return UploadedFileInterface []
© 2020 Bruce Wells
Search Namespaces \ Classes
Configuration Numbers (0-9.) only