Request
class Request
Executes requets.
Properties
protected string | $scriptName | Script name. | |
protected Parameters | $query | Get data. | |
protected Parameters | $post | Post data. | |
protected Cookies | $cookies | Cookie data. | |
protected Files | $files | File data. | |
protected Server | $server | Server info. | |
protected Headers | $headers | Request headers. | |
protected string | $rawBody | Raw request body. | |
protected Parameters | $parsedBody | Parsed request body. | |
protected string | $contentType | Content type. | |
protected array | $trustedProxies | Array of trusted proxy IP addresses. | |
protected string | $ip | Ip address of the client that made the request. | |
protected string | $basePath | Base path of the request. | |
protected string | $baseURL | Base URL of the request. | |
protected string | $path | Holds the request path. | |
protected array | $language | Request language. | |
protected string | $languagePrefix | Request language prefix. | |
protected string | $method | Which request method was used? | |
protected string | $realMethod | The actual request method that was used. | |
protected Route | $route | The route that matched the request. | |
protected array | $attributes | Request attribuntes. |
Methods
Strips the locale segment from the path.
Determines the request path.
Determines the request method.
Returns the content type of the request body.
Returns the base name of the script that handled the request.
Sets a request attribute.
Gets a request attribute.
Returns the raw request body.
Returns the raw request body as a stream.
Returns the query string.
Returns the post data.
Returns the cookies.
Returns the files.
Returns true if the request has form data and false if not.
Returns the data of the current request method.
Set the trusted proxies.
Returns the ip of the client that made the request.
Returns true if the request was made using Ajax and false if not.
Returns true if the request was made using HTTPS and false if not.
Returns true if the request method is considered safe and false if not.
Is PHP running as a CGI program?
Returns the base path of the request.
Returns the base url of the request.
Returns the request path.
Returns true if the resource was requested with a "clean" URL and false if not.
Returns the request language.
Returns the request language prefix.
Returns the request method that was used.
Returns the real request method that was used.
Returns true if the request method has been faked and false if not.
Returns the basic HTTP authentication username or null.
Returns the basic HTTP authentication password or null.
Returns the referrer.
Details
at line 203
__construct(array $request = [], Signer|null $signer = null)
Constructor.
at line 235
protected string
stripLocaleSegment(array $languages, string $path)
Strips the locale segment from the path.
at line 260
protected string
determinePath(array $languages)
Determines the request path.
at line 302
protected string
determineMethod()
Determines the request method.
at line 320
string
getContentType()
Returns the content type of the request body.
An empty string will be returned if the header is missing.
at line 335
string
getScriptName()
Returns the base name of the script that handled the request.
at line 345
setRoute(Route $route)
Set the route that matched the request.
at line 355
Route|null
getRoute()
Returns the route that matched the request.
at line 366
setAttribute(string $name, mixed $value)
Sets a request attribute.
at line 378
mixed
getAttribute(string $name, mixed $default = null)
Gets a request attribute.
at line 388
string
getRawBody()
Returns the raw request body.
at line 403
resource
getRawBodyAsStream()
Returns the raw request body as a stream.
at line 413
Parameters
getQuery()
Returns the query string.
at line 423
Parameters
getPost()
Returns the post data.
at line 433
Cookies
getCookies()
Returns the cookies.
at line 443
Files
getFiles()
Returns the files.
at line 453
Server
getServer()
Returns the files.
at line 463
Headers
getHeaders()
Returns the files.
at line 473
Body
getBody()
Returns the parsed request body.
at line 488
protected bool
hasFormData()
Returns true if the request has form data and false if not.
at line 505
Parameters
getData()
Returns the data of the current request method.
at line 524
setTrustedProxies(array $trustedProxies)
Set the trusted proxies.
at line 534
string
getIp()
Returns the ip of the client that made the request.
at line 576
bool
isAjax()
Returns true if the request was made using Ajax and false if not.
at line 586
bool
isSecure()
Returns true if the request was made using HTTPS and false if not.
at line 596
bool
isSafe()
Returns true if the request method is considered safe and false if not.
at line 606
bool
isCGI()
Is PHP running as a CGI program?
at line 616
string
getBasePath()
Returns the base path of the request.
at line 633
string
getBaseURL()
Returns the base url of the request.
at line 668
string
getPath()
Returns the request path.
at line 678
bool
isClean()
Returns true if the resource was requested with a "clean" URL and false if not.
at line 688
array|null
getLanguage()
Returns the request language.
at line 698
string|null
getLanguagePrefix()
Returns the request language prefix.
at line 708
string
getMethod()
Returns the request method that was used.
at line 718
string
getRealMethod()
Returns the real request method that was used.
at line 728
bool
isFaked()
Returns true if the request method has been faked and false if not.
at line 738
string|null
getUsername()
Returns the basic HTTP authentication username or null.
at line 748
string|null
getPassword()
Returns the basic HTTP authentication password or null.
at line 759
mixed
getReferrer(mixed $default = null)
Returns the referrer.