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

GET

POST

HEAD

PUT

DELETE

PATCH

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|null
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
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 59
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 64
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 70
FileUpload|null 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|null

at line 76
array getFiles()

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

Return Value

array

at line 81
mixed getCookie(string $key)

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

Parameters

string $key

Return Value

mixed

at line 87
array getCookies()

Returns all cookies.

Return Value

array

at line 94
string getMethod()

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

Return Value

string

at line 99
bool isMethod(string $method)

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

Parameters

string $method

Return Value

bool

at line 104
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 110
array getHeaders()

Returns all HTTP headers.

Return Value

array

at line 115
bool isSecured()

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

Return Value

bool

at line 120
bool isAjax()

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

Return Value

bool

at line 125
string|null getRemoteAddress()

Returns the IP address of the remote client.

Return Value

string|null

at line 130
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