interface IRequest

HTTP request contract providing access to URL, headers, cookies, uploaded files, and body.

Constants

Get

HTTP request method

Post

HTTP request method

Head

HTTP request method

Put

HTTP request method

Delete

HTTP request method

Patch

HTTP request method

Options

HTTP request method

deprecated GET

deprecated POST

deprecated HEAD

deprecated PUT

deprecated DELETE

deprecated PATCH

deprecated OPTIONS

Methods

getUrl()

Returns the request URL.

mixed
getQuery(string|null $key = null)

Returns a URL query parameter, or all parameters as an array if no key is given.

mixed
getPost(string|null $key = null)

Returns a POST parameter, or all POST parameters as an array if no key is given.

FileUpload
getFile(string $key)

Returns the uploaded file for the given key, or null if not present.

array
getFiles()

Returns the tree of uploaded files, with each leaf being a FileUpload instance.

mixed
getCookie(string $key)

Returns a cookie value, or null if it does not exist.

array
getCookies()

Returns all cookies.

string
getMethod()

Returns the HTTP request method (GET, POST, HEAD, PUT, ...).

bool
isMethod(string $method)

Checks the HTTP request method. The comparison is case-insensitive.

string|null
getHeader(string $header)

Returns the value of an HTTP header, or null if it does not exist. The name is case-insensitive.

array
getHeaders()

Returns all HTTP headers.

bool
isSecured()

Checks whether the request was sent via a secure channel (HTTPS).

bool
isAjax()

Checks whether the request was made via AJAX (X-Requested-With: XMLHttpRequest).

string|null
getRemoteAddress()

Returns the IP address of the remote client.

string|null
getRemoteHost()

No description

string|null
getRawBody()

Returns raw content of HTTP request body.

bool
isFrom(FetchSite> $site, FetchDest>|null $dest = null, ?bool $user = null)

No description

Details

at line 52
UrlScript getUrl()

Returns the request URL.

Return Value

UrlScript

at line 60
mixed getQuery(string|null $key = null)

Returns a URL query parameter, or all parameters as an array if no key is given.

Parameters

string|null $key

Return Value

mixed

at line 66
mixed getPost(string|null $key = null)

Returns a POST parameter, or all POST parameters as an array if no key is given.

Parameters

string|null $key

Return Value

mixed

at line 73
FileUpload getFile(string $key)

Returns the uploaded file for the given key, or null if not present.

Accepts a string key or an array of keys for nested file structures (e.g. ['form', 'avatar']).

Parameters

string $key

Return Value

FileUpload

at line 79
array getFiles()

Returns the tree of uploaded files, with each leaf being a FileUpload instance.

Return Value

array

at line 85
mixed getCookie(string $key)

Returns a cookie value, or null if it does not exist.

Parameters

string $key

Return Value

mixed

at line 91
array getCookies()

Returns all cookies.

Return Value

array

at line 98
string getMethod()

Returns the HTTP request method (GET, POST, HEAD, PUT, ...).

Return Value

string

at line 103
bool isMethod(string $method)

Checks the HTTP request method. The comparison is case-insensitive.

Parameters

string $method

Return Value

bool

at line 108
string|null getHeader(string $header)

Returns the value of an HTTP header, or null if it does not exist. The name is case-insensitive.

Parameters

string $header

Return Value

string|null

at line 114
array getHeaders()

Returns all HTTP headers.

Return Value

array

at line 119
bool isSecured()

Checks whether the request was sent via a secure channel (HTTPS).

Return Value

bool

at line 124
bool isAjax()

Checks whether the request was made via AJAX (X-Requested-With: XMLHttpRequest).

Return Value

bool

at line 129
string|null getRemoteAddress()

Returns the IP address of the remote client.

Return Value

string|null

at line 131
string|null getRemoteHost()

No description

Return Value

string|null

at line 137
string|null getRawBody()

Returns raw content of HTTP request body.

Return Value

string|null

at line 16
bool isFrom(FetchSite> $site, FetchDest>|null $dest = null, ?bool $user = null)

No description

Parameters

FetchSite> $site
FetchDest>|null $dest
?bool $user

Return Value

bool