IRequest
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
Returns a URL query parameter, or all parameters as an array if no key is given.
Returns a POST parameter, or all POST parameters as an array if no key is given.
Returns the uploaded file for the given key, or null if not present.
Returns the tree of uploaded files, with each leaf being a FileUpload instance.
Returns a cookie value, or null if it does not exist.
Returns all cookies.
Returns the HTTP request method (GET, POST, HEAD, PUT, ...).
Checks the HTTP request method. The comparison is case-insensitive.
Returns the value of an HTTP header, or null if it does not exist. The name is case-insensitive.
Returns all HTTP headers.
Checks whether the request was sent via a secure channel (HTTPS).
Checks whether the request was made via AJAX (X-Requested-With: XMLHttpRequest).
Returns the IP address of the remote client.
No description
Returns raw content of HTTP request body.
No description
Details
at line 52
UrlScript
getUrl()
Returns the request URL.
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.
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.
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']).
at line 79
array
getFiles()
Returns the tree of uploaded files, with each leaf being a FileUpload instance.
at line 85
mixed
getCookie(string $key)
Returns a cookie value, or null if it does not exist.
at line 91
array
getCookies()
Returns all cookies.
at line 98
string
getMethod()
Returns the HTTP request method (GET, POST, HEAD, PUT, ...).
at line 103
bool
isMethod(string $method)
Checks the HTTP request method. The comparison is case-insensitive.
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.
at line 114
array
getHeaders()
Returns all HTTP headers.
at line 119
bool
isSecured()
Checks whether the request was sent via a secure channel (HTTPS).
at line 124
bool
isAjax()
Checks whether the request was made via AJAX (X-Requested-With: XMLHttpRequest).
at line 129
string|null
getRemoteAddress()
Returns the IP address of the remote client.
at line 131
string|null
getRemoteHost()
No description
at line 137
string|null
getRawBody()
Returns raw content of HTTP request body.
at line 16
bool
isFrom(FetchSite> $site, FetchDest>|null $dest = null, ?bool $user = null)
No description