URLBuilder
class URLBuilder
URL builder.
Properties
protected Request | $request | Request instance. | |
protected Routes | $routes | Route collection. | |
protected bool | $cleanURLs | Create "clean" URLs? | |
protected string | $baseURL | Base URL. | |
protected string | $scriptName | Script name. | |
protected string | $languagePrefix | Language prefix. |
Methods
__construct(Request $request, Routes $routes, bool $cleanURLs = false, string|null $baseURL = null)
Constructor.
bool
matches(string $pattern)
Returns TRUE if the pattern matches the current route and FALSE if not.
string
base()
Returns the base URL of the application.
string
to(string $path, array $queryParams = [], string $separator = '&', mixed $language = true)
Returns the URL of the specified path.
string
toRoute(string $routeName, array $routeParams = [], array $queryParams = [], string $separator = '&', mixed $language = true)
Returns the URL of a named route.
string
current(array|null $queryParams = [], string $separator = '&', mixed $language = true)
Returns the current URL of the request.
string
toLanguage(string $route, mixed $language, array $queryParams = [], string $separator = '&')
Returns the URL of the specified route.
string
toRouteLanguage(string $routeName, string $language, array $routeParams = [], array $queryParams = [], string $separator = '&')
Returns the URL of a named route.
string
currentLanguage(string $language, array|null $queryParams = [], string $separator = '&')
Returns the current URL of the request.
Details
at line 72
__construct(Request $request, Routes $routes, bool $cleanURLs = false, string|null $baseURL = null)
Constructor.
at line 96
bool
matches(string $pattern)
Returns TRUE if the pattern matches the current route and FALSE if not.
at line 106
string
base()
Returns the base URL of the application.
at line 120
string
to(string $path, array $queryParams = [], string $separator = '&', mixed $language = true)
Returns the URL of the specified path.
at line 142
string
toRoute(string $routeName, array $routeParams = [], array $queryParams = [], string $separator = '&', mixed $language = true)
Returns the URL of a named route.
at line 172
string
current(array|null $queryParams = [], string $separator = '&', mixed $language = true)
Returns the current URL of the request.
at line 188
string
toLanguage(string $route, mixed $language, array $queryParams = [], string $separator = '&')
Returns the URL of the specified route.
at line 203
string
toRouteLanguage(string $routeName, string $language, array $routeParams = [], array $queryParams = [], string $separator = '&')
Returns the URL of a named route.
at line 216
string
currentLanguage(string $language, array|null $queryParams = [], string $separator = '&')
Returns the current URL of the request.