interface IRequest

HTTP request provides access scheme for request sent via HTTP.

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 URL object.

mixed
getQuery(string|null $key = null)

Returns variable provided to the script via URL query ($_GET).

mixed
getPost(string|null $key = null)

Returns variable provided to the script via POST method ($_POST).

FileUpload|null
getFile(string $key)

Returns uploaded file.

array
getFiles()

Returns uploaded files.

mixed
getCookie(string $key)

Returns variable provided to the script via HTTP cookies.

array
getCookies()

Returns variables provided to the script via HTTP cookies.

string
getMethod()

Returns HTTP request method (GET, POST, HEAD, PUT, ...). The method is case-sensitive.

bool
isMethod(string $method)

Checks HTTP request method.

string|null
getHeader(string $header)

Return the value of the HTTP header. Pass the header name as the plain, HTTP-specified header name (e.g. 'Accept-Encoding').

array
getHeaders()

Returns all HTTP headers.

bool
isSecured()

Is the request sent via secure channel (https)?

bool
isAjax()

Is AJAX request?

string|null
getRemoteAddress()

Returns the IP address of the remote client.

string|null
getRemoteHost()

Returns the host of the remote client.

string|null
getRawBody()

Returns raw content of HTTP request body.

UrlImmutable|null
getReferer()

Returns referrer.

bool
isSameSite()

Is the request sent from the same origin?

Details

at line 54
UrlScript getUrl()

Returns URL object.

Return Value

UrlScript

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

Returns variable provided to the script via URL query ($_GET).

If no key is passed, returns the entire array.

Parameters

string|null $key

Return Value

mixed

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

Returns variable provided to the script via POST method ($_POST).

If no key is passed, returns the entire array.

Parameters

string|null $key

Return Value

mixed

at line 73
FileUpload|null getFile(string $key)

Returns uploaded file.

Parameters

string $key

Return Value

FileUpload|null

at line 78
array getFiles()

Returns uploaded files.

Return Value

array

at line 83
mixed getCookie(string $key)

Returns variable provided to the script via HTTP cookies.

Parameters

string $key

Return Value

mixed

at line 88
array getCookies()

Returns variables provided to the script via HTTP cookies.

Return Value

array

at line 95
string getMethod()

Returns HTTP request method (GET, POST, HEAD, PUT, ...). The method is case-sensitive.

Return Value

string

at line 100
bool isMethod(string $method)

Checks HTTP request method.

Parameters

string $method

Return Value

bool

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

Return the value of the HTTP header. Pass the header name as the plain, HTTP-specified header name (e.g. 'Accept-Encoding').

Parameters

string $header

Return Value

string|null

at line 111
array getHeaders()

Returns all HTTP headers.

Return Value

array

at line 116
bool isSecured()

Is the request sent via secure channel (https)?

Return Value

bool

at line 121
bool isAjax()

Is AJAX request?

Return Value

bool

at line 126
string|null getRemoteAddress()

Returns the IP address of the remote client.

Return Value

string|null

at line 131
string|null getRemoteHost()

Returns the host of the remote client.

Return Value

string|null

at line 136
string|null getRawBody()

Returns raw content of HTTP request body.

Return Value

string|null

at line 18
UrlImmutable|null getReferer()

Returns referrer.

Return Value

UrlImmutable|null

at line 18
bool isSameSite()

Is the request sent from the same origin?

Return Value

bool