Menu

## WebRequest
in package

WebRequest.php : 14

### Table of Contents

$attributes : Collection
$body : array<string|int, mixed>
$cookies : Collection
$domain : mixed
$files : array<string|int, mixed>
$headers : Collection
$method : mixed
$originIp : mixed
$originPort : mixed
$params : Collection
$protocolVersion : string
$rawBody : string
$serverParams : Collection
$uri : Uri
__construct() : mixed
__dangerouslyGetAll() : array<string|int, mixed>
__dangerouslytoArray() : array<string|int, mixed>
contains() : bool
getAll() : static
  Return an instance that removes the specified derived request attribute.
getAttributes() : array<string|int, mixed>
  Retrieve attributes derived from the request.
getBody() : StreamInterface
  Gets the body of the message.
getCookieParams() : array<string|int, mixed>
  Retrieve cookies.
getHeaderLine() : string
  Retrieves a comma-separated string of the values for a single header.
getHeaders() : array<string|int, array<string|int, string>>
  Retrieves all message header values.
getMethod() : string
  Retrieves the HTTP method of the request.
getParsedBody() : null|array<string|int, mixed>|object
  Retrieve any parameters provided in the request body.
getProtocolVersion() : string
  Retrieves the HTTP protocol version as a string.
getQueryParams() : array<string|int, mixed>
  Retrieve query string arguments.
getServerParams() : array<string|int, mixed>
  Retrieve server parameters.
getUploadedFiles() : array<string|int, mixed>
  Retrieve normalized file upload data.
getUri() : UriInterface
  Retrieves the URI instance.
hasHeader() : bool
  Checks if a header exists by the given case-insensitive name.
isMethod() : bool
  Helper method to determine if the request method matches the specified method.
toArray() : array<string|int, mixed>
withMethod() : static
  Return an instance with the provided HTTP method.

### Properties

#### $attributes

WebRequest.php : 33
`private Collection $attributes`

#### $body

WebRequest.php : 31
`private array<string|int, mixed> $body = array()`

#### $cookies

WebRequest.php : 25
`private Collection $cookies`

#### $domain

WebRequest.php : 43
`private mixed $domain = ''`

#### $files

WebRequest.php : 27
`private array<string|int, mixed> $files = array()`

#### $headers

WebRequest.php : 19
`private Collection $headers`

#### $method

WebRequest.php : 37
`private mixed $method = ''`

#### $originIp

WebRequest.php : 39
`private mixed $originIp = ''`

#### $originPort

WebRequest.php : 41
`private mixed $originPort = ''`

#### $params

WebRequest.php : 21
`private Collection $params`

#### $protocolVersion

WebRequest.php : 17
`private string $protocolVersion = ''`

#### $rawBody

WebRequest.php : 29
`private string $rawBody`

#### $serverParams

WebRequest.php : 23
`private Collection $serverParams`

#### $uri

WebRequest.php : 35
`private Uri $uri`

### Methods

#### __construct()

WebRequest.php : 47
`public __construct() : mixed`

##### Return values

mixed —

#### __dangerouslyGetAll()

WebRequest.php : 712
`public __dangerouslyGetAll() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

#### __dangerouslytoArray()

WebRequest.php : 735
`public __dangerouslytoArray() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

#### contains()

WebRequest.php : 765
`public contains(mixed ...$keys) : bool`

##### Parameters

$keys : mixed

##### Return values

bool —

#### getAll()

WebRequest.php : 700

Return an instance that removes the specified derived request attribute.

`public getAll() : static`

This method allows removing a single derived request attribute as described in getAttributes().

This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return an instance that removes the attribute.

##### Tags

see
  getAttributes()

##### Return values

static —

#### getAttributes()

WebRequest.php : 635

Retrieve attributes derived from the request.

`public getAttributes() : array<string|int, mixed>`

The request "attributes" may be used to allow injection of any parameters derived from the request: e.g., the results of path match operations; the results of decrypting cookies; the results of deserializing non-form-encoded message bodies; etc. Attributes will be application and request specific, and CAN be mutable.

##### Return values

array<string|int, mixed> —

Attributes derived from the request.

#### getBody()

WebRequest.php : 291

Gets the body of the message.

`public getBody() : StreamInterface`

##### Return values

StreamInterface —

Returns the body as a stream.

#### getCookieParams()

WebRequest.php : 463

Retrieve cookies.

`public getCookieParams() : array<string|int, mixed>`

Retrieves cookies sent by the client to the server.

The data MUST be compatible with the structure of the $_COOKIE superglobal.

##### Return values

array<string|int, mixed> —

#### getHeaderLine()

WebRequest.php : 222

Retrieves a comma-separated string of the values for a single header.

`public getHeaderLine(string $name) : string`

This method returns all of the header values of the given case-insensitive header name as a string concatenated together using a comma.

NOTE: Not all header values may be appropriately represented using comma concatenation. For such headers, use getHeader() instead and supply your own delimiter when concatenating.

If the header does not appear in the message, this method MUST return an empty string.

##### Parameters

$name : string

  Case-insensitive header field name.

##### Return values

string —

A string of values as provided for the given header concatenated together using a comma. If the header does not appear in the message, this method MUST return an empty string.

#### getHeaders()

WebRequest.php : 166

Retrieves all message header values.

`public getHeaders() : array<string|int, array<string|int, string>>`

The keys represent the header name as it will be sent over the wire, and each value is an array of strings associated with the header.

    // Represent the headers as a string
    foreach ($message->getHeaders() as $name => $values) {
        echo $name . ": " . implode(", ", $values);
    }

    // Emit headers iteratively:
    foreach ($message->getHeaders() as $name => $values) {
        foreach ($values as $value) {
            header(sprintf('%s: %s', $name, $value), false);
        }
    }

While header names are not case-sensitive, getHeaders() will preserve the exact case in which headers were originally specified.

##### Return values

array<string|int, array<string|int, string>> —

Returns an associative array of the message's headers. Each key MUST be a header name, and each value MUST be an array of strings for that header.

#### getMethod()

WebRequest.php : 362

Retrieves the HTTP method of the request.

`public getMethod() : string`

##### Return values

string —

Returns the request method.

#### getParsedBody()

WebRequest.php : 585

Retrieve any parameters provided in the request body.

`public getParsedBody() : null|array<string|int, mixed>|object`

If the request Content-Type is either application/x-www-form-urlencoded or multipart/form-data, and the request method is POST, this method MUST return the contents of $_POST.

Otherwise, this method may return any results of deserializing the request body content; as parsing returns structured content, the potential types MUST be arrays or objects only. A null value indicates the absence of body content.

##### Return values

null|array<string|int, mixed>|object —

The deserialized body parameters, if any. These will typically be an array or object.

#### getProtocolVersion()

WebRequest.php : 118

Retrieves the HTTP protocol version as a string.

`public getProtocolVersion() : string`

The string MUST contain only the HTTP version number (e.g., "1.1", "1.0").

##### Return values

string —

HTTP protocol version.

#### getQueryParams()

WebRequest.php : 503

Retrieve query string arguments.

`public getQueryParams() : array<string|int, mixed>`

Retrieves the deserialized query string arguments, if any.

Note: the query params might not be in sync with the URI or server params. If you need to ensure you are only getting the original values, you may need to parse the query string from `getUri()->getQuery()` or from the `QUERY_STRING` server param.

##### Return values

array<string|int, mixed> —

#### getServerParams()

WebRequest.php : 448

Retrieve server parameters.

`public getServerParams() : array<string|int, mixed>`

Retrieves data related to the incoming request environment, typically derived from PHP's $_SERVER superglobal. The data IS NOT REQUIRED to originate from $_SERVER.

##### Return values

array<string|int, mixed> —

#### getUploadedFiles()

WebRequest.php : 548

Retrieve normalized file upload data.

`public getUploadedFiles() : array<string|int, mixed>`

This method returns upload metadata in a normalized tree, with each leaf an instance of Psr\Http\Message\UploadedFileInterface.

These values MAY be prepared from $_FILES or the message body during instantiation, or MAY be injected via withUploadedFiles().

##### Return values

array<string|int, mixed> —

An array tree of UploadedFileInterface instances; an empty array MUST be returned if no data is present.

#### getUri()

WebRequest.php : 399

Retrieves the URI instance.

`public getUri() : UriInterface`

This method MUST return a UriInterface instance.

##### Tags

link
  http://tools.ietf.org/html/rfc3986#section-4.3

##### Return values

UriInterface —

Returns a UriInterface instance representing the URI of the request.

#### hasHeader()

WebRequest.php : 179

Checks if a header exists by the given case-insensitive name.

`public hasHeader(string $name) : bool`

##### Parameters

$name : string

  Case-insensitive header field name.

##### Return values

bool —

Returns true if any header names match the given header name using a case-insensitive string comparison. Returns false if no matching header name is found in the message.

#### isMethod()

WebRequest.php : 760

Helper method to determine if the request method matches the specified method.

`public isMethod(string $method) : bool`

##### Parameters

$method : string

##### Return values

bool —

#### toArray()

WebRequest.php : 724
`public toArray() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

#### withMethod()

WebRequest.php : 382

Return an instance with the provided HTTP method.

`public withMethod(string $method) : static`

While HTTP method names are typically all uppercase characters, HTTP method names are case-sensitive and thus implementations SHOULD NOT modify the given string.

This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return an instance that has the changed request method.

##### Parameters

$method : string

  Case-sensitive method.

##### Tags

throws
  InvalidArgumentException

  for invalid HTTP methods.

##### Return values

static —

## Search results