ServerRequest Class

Aurora\Http Namespace

Extends

Interfaces

  • I MessageInterface
  • I RequestInterface
  • I ServerRequestInterface

Properties

attributes
protected $attributes = []: array

cookieParams
protected $cookieParams = []: array

parsedBody
protected $parsedBody: mixed

queryParams
protected $queryParams = []: array

serverParams
protected $serverParams: array

uploadedFiles
protected $uploadedFiles = []: array

Constructor

__construct

Constructor

Parameters

  • string $method — HTTP method
  • mixed $uri — Request URI
  • array $headers — Request headers
  • mixed $body — Request body
  • string $version — HTTP protocol version
  • array $serverParams — Server paremeters

Signature

public function __construct(string $method, mixed $uri, array $headers = [], mixed $body, string $version = '1.1', array $serverParams = [])

Methods

__construct

Constructor

Parameters

  • string $method — HTTP method
  • mixed $uri — Request URI
  • array $headers — Request headers
  • mixed $body — Request body
  • string $version — HTTP protocol version
  • array $serverParams — Server paremeters

Signature

public function __construct(string $method, mixed $uri, array $headers = [], mixed $body, string $version = '1.1', array $serverParams = [])

getServerParams

Retrieve server parameters.

Return Value

  • array

Signature

public function getServerParams()

getCookieParams

Retrieve cookies.

Return Value

  • array

Signature

public function getCookieParams()

withCookieParams

Return an instance with the specified cookies

Parameters

  • array $cookies — Array of key/value pairs representing cookies.

Return Value

  • \ServerRequest

Signature

public function withCookieParams(array $cookies)

getQueryParams

Retrieve query string arguments

Return Value

  • array

Signature

public function getQueryParams()

withQueryParams

Return an instance with the specified query string arguments

Parameters

  • array $query — Array of query string arguments, typically from $_GET

Return Value

  • \ServerRequest

Signature

public function withQueryParams(array $query)

getUploadedFiles

Retrieve normalized file upload data

Return Value

  • array

Signature

public function getUploadedFiles()

withUploadedFiles

Create a new instance with the specified uploaded files

Parameters

  • array $uploadedFiles — An array tree of UploadedFileInterface instances

Return Value

  • \ServerRequest

Signature

public function withUploadedFiles(array $uploadedFiles)

getParsedBody

Retrieve any parameters provided in the request body

Return Value

  • mixed

Signature

public function getParsedBody()

withParsedBody

Return an instance with the specified body parameters

Parameters

  • mixed $data — The deserialized body data. This will typically be in an array or object

Return Value

  • \ServerRequest

Signature

public function withParsedBody(mixed $data)

getAttributes

Retrieve attributes derived from the request

Return Value

  • array Attributes derived from the request

Signature

public function getAttributes()

getAttribute

Retrieve a single derived request attribute

Parameters

  • mixed $name — The attribute name
  • mixed $default — Default value to return if the attribute does not exist

Return Value

  • mixed

Signature

public function getAttribute(mixed $name, mixed $default)

withAttribute

Return an instance with the specified derived request attribute

Parameters

  • mixed $name — The attribute name
  • mixed $value — The value of the attribute

Return Value

  • \ServerRequest

Signature

public function withAttribute(mixed $name, mixed $value)

withoutAttribute

Return an instance that removes the specified derived request attribute

Parameters

  • mixed $name — The attribute name

Return Value

  • \ServerRequest

Signature

public function withoutAttribute(mixed $name)

Go to top