WithLocalURL
trait WithLocalURL
Methods
withBaseUrl(string $url)
No description
withSiteUrl(string $url)
No description
string
buildUrl(string ...$parts)
Gets the URL matching the specified resource.
string
getCurrentUrl()
Gets $_SERVER["PATH_INFO"] or computes the equivalent if not defined.
array
getCurrentUrlFragments()
Gets an array of url fragments to be processed by controller
Details
at line 25
WithLocalURL
withBaseUrl(string $url)
No description
at line 31
WithLocalURL
withSiteUrl(string $url)
No description
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"
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.
at line 154
array
getCurrentUrlFragments()
Gets an array of url fragments to be processed by controller