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

Parameters

string $url

Return Value

WithLocalURL

at line 31
WithLocalURL withSiteUrl(string $url)

No description

Parameters

string $url

Return Value

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"

Parameters

string ...$parts

The URL parts

Return Value

string

the URL matching the specified resource

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.

Return Value

string

the relevant URL part

at line 154
array getCurrentUrlFragments()

Gets an array of url fragments to be processed by controller

Return Value

array

an array of string, one for each URL fragment

See also

\Keruald\OmniTools\HTTP\Requests\self::getCurrentUrl() This method is used by the controllers' entry points to know the URL and call relevant subcontrollers.