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 74
__construct(Request $request, Routes $routes, bool $cleanURLs = false, string|null $baseURL = null)
Constructor.
at line 98
bool
matches(string $pattern)
Returns TRUE if the pattern matches the current route and FALSE if not.
at line 108
string
base()
Returns the base URL of the application.
at line 122
string
to(string $path, array $queryParams = [], string $separator = '&', mixed $language = true)
Returns the URL of the specified path.
at line 144
string
toRoute(string $routeName, array $routeParams = [], array $queryParams = [], string $separator = '&', mixed $language = true)
Returns the URL of a named route.
at line 174
string
current(array|null $queryParams = [], string $separator = '&', mixed $language = true)
Returns the current URL of the request.
at line 190
string
toLanguage(string $route, mixed $language, array $queryParams = [], string $separator = '&')
Returns the URL of the specified route.
at line 205
string
toRouteLanguage(string $routeName, string $language, array $routeParams = [], array $queryParams = [], string $separator = '&')
Returns the URL of a named route.
at line 218
string
currentLanguage(string $language, array|null $queryParams = [], string $separator = '&')
Returns the current URL of the request.