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 |
| GET |
|
| POST |
|
| HEAD |
|
| PUT |
|
| DELETE |
|
| PATCH |
|
| 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.
Returns raw content of HTTP request body.
No description
Details
at line 52
UrlScript
getUrl()
Returns the request URL.
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.
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.
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']).
at line 76
array
getFiles()
Returns the tree of uploaded files, with each leaf being a FileUpload instance.
at line 81
mixed
getCookie(string $key)
Returns a cookie value, or null if it does not exist.
at line 87
array
getCookies()
Returns all cookies.
at line 94
string
getMethod()
Returns the HTTP request method (GET, POST, HEAD, PUT, ...).
at line 99
bool
isMethod(string $method)
Checks the HTTP request method. The comparison is case-insensitive.
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.
at line 110
array
getHeaders()
Returns all HTTP headers.
at line 115
bool
isSecured()
Checks whether the request was sent via a secure channel (HTTPS).
at line 120
bool
isAjax()
Checks whether the request was made via AJAX (X-Requested-With: XMLHttpRequest).
at line 125
string|null
getRemoteAddress()
Returns the IP address of the remote client.
at line 130
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