interface RequestInterface implements MessageInterface

Interface RequestInterface

Constants

METHOD_OPTIONS

METHOD_GET

METHOD_HEAD

METHOD_POST

METHOD_PUT

METHOD_DELETE

METHOD_PATCH

Methods

string|array|null
getHeader(string $name, string|boolean $glue = "\r\n")

Returns a header value.

array
getHeaders()

Returns an array of header lines.

setHeaders(array $headers)

Sets all headers on the current message.

addHeader(string $header)

Adds a header to this message.

addHeaders(array $headers)

Adds a set of headers to this message.

string
getContent()

Returns the content of the message.

setContent(string $content)

Sets the content of the message.

string
__toString()

Returns the message document.

string
getMethod()

Returns the HTTP method of the current request.

setMethod(string $method)

Sets the HTTP method of the current request.

string
getResource()

Returns the resource portion of the request line.

setResource(string $resource)

Sets the resource for the current request.

float
getProtocolVersion()

Returns the protocol version of the current request.

string|null
getHost()

Returns the value of the host header.

setHost(string $host)

Sets the host for the current request.

Boolean
isSecure()

Checks if the current request is secure.

Details

in MessageInterface at line 19
string|array|null getHeader(string $name, string|boolean $glue = "\r\n")

Returns a header value.

Parameters

string $name A header name
string|boolean $glue Glue for implode, or false to return an array

Return Value

string|array|null The header value(s)

in MessageInterface at line 26
array getHeaders()

Returns an array of header lines.

Return Value

array An array of header lines (integer indexes, e.g. ["Header: value"])

in MessageInterface at line 35
setHeaders(array $headers)

Sets all headers on the current message.

Headers can be complete ["Header: value"] pairs or an associative array ["Header" => "value"]

Parameters

array $headers An array of header lines

in MessageInterface at line 42
addHeader(string $header)

Adds a header to this message.

Parameters

string $header A header line

in MessageInterface at line 51
addHeaders(array $headers)

Adds a set of headers to this message.

Headers can be complete ["Header: value"] pairs or an associative array ["Header" => "value"]

Parameters

array $headers Headers

in MessageInterface at line 58
string getContent()

Returns the content of the message.

Return Value

string The message content

in MessageInterface at line 65
setContent(string $content)

Sets the content of the message.

Parameters

string $content The message content

in MessageInterface at line 72
string __toString()

Returns the message document.

Return Value

string The message

at line 24
string getMethod()

Returns the HTTP method of the current request.

Return Value

string An HTTP method

at line 31
setMethod(string $method)

Sets the HTTP method of the current request.

Parameters

string $method The request method

at line 38
string getResource()

Returns the resource portion of the request line.

Return Value

string The resource requested

at line 45
setResource(string $resource)

Sets the resource for the current request.

Parameters

string $resource The resource being requested

at line 52
float getProtocolVersion()

Returns the protocol version of the current request.

Return Value

float The protocol version

at line 59
string|null getHost()

Returns the value of the host header.

Return Value

string|null The host

at line 66
setHost(string $host)

Sets the host for the current request.

Parameters

string $host The host

at line 73
Boolean isSecure()

Checks if the current request is secure.

Return Value

Boolean True if the request is secure