Request
class Request
Traits
Methods
Gets the languages accepted by the browser, by order of priority.
Create a URL object, using the current request server URL for protocol and domain name.
Gets $_SERVER["PATH_INFO"] or computes the equivalent if not defined.
Gets an array of url fragments to be processed by controller
Details
in
WithAcceptedLanguages at line 18
static array
getAcceptedLanguages()
Gets the languages accepted by the browser, by order of priority.
This will read the HTTP_ACCEPT_LANGUAGE variable sent by the browser in the HTTP request.
in
WithRemoteAddress at line 21
static string
getRemoteAddress()
Gets remote IP address.
This is intended as a drop-in replacement for $_SERVER['REMOTE_ADDR'], which takes in consideration proxy values, blindly trusted.
This method should is only for environment where headers are controlled, like nginx + phpfpm, where HTTP headers are reserved for the server information, and where the headers sent by the web server to nginx are checked or populated by nginx itself.
in
WithRemoteAddress at line 25
static bool
isFromLocalHost()
No description
in
WithURL at line 14
static string
getServerURL()
No description
in
WithURL at line 37
static int
getPort()
No description
in
WithURL at line 41
static string
getServerName()
No description
in
WithURL at line 45
static string
getScheme()
No description
in
WithURL at line 57
static bool
isHTTPS()
No description
in
WithURL at line 95
static URL
createLocalURL(string $query = "", int $encodeMode = URL::ENCODE_RFC3986_SLASH_EXCEPTED)
Create a URL object, using the current request server URL for protocol and domain name.
in
WithLocalURL at line 25
WithLocalURL
withBaseUrl(string $url)
No description
in
WithLocalURL at line 31
WithLocalURL
withSiteUrl(string $url)
No description
in
WithLocalURL at line 57
string
buildUrl(string ...$parts)
Gets the URL matching the specified resource.
Example:
$ship = new Ship();
$ship->id = "S00001";
$request = new Request();
$url = $request->buildUrl("ship", $ship->id);
echo $url; // This should print "/ship/S00001"
in
WithLocalURL at line 97
string
getCurrentUrl()
Gets $_SERVER["PATH_INFO"] or computes the equivalent if not defined.
This function allows the entry point controllers to get the current URL consistently, for any redirection configuration.
So with /foo/bar, /index.php/foo/bar, /zed/index.php/foo/bar or /zed/foo/bar
Request::getCurrentUrl() will return /foo/bar each time.
in
WithLocalURL at line 154
array
getCurrentUrlFragments()
Gets an array of url fragments to be processed by controller