interface UrlGenerator

Methods

string
current()

Get the current URL for the request.

string
previous(bool|string $fallback = false)

Get the URL for the previous request.

string
to(string $path, array|string $extra = [], bool|null $secure = null)

Generate an absolute URL to the given path.

string
secure(string $path, array $parameters = [])

Generate a secure, absolute URL to the given path.

string
asset(string $path, bool|null $secure = null)

Generate the URL to an application asset.

string
route(BackedEnum|string $name, mixed $parameters = [], bool $absolute = true)

Get the URL to a named route.

string
signedRoute(BackedEnum|string $name, mixed $parameters = [], DateInterval|DateTimeInterface|int|null $expiration = null, bool $absolute = true)

Create a signed route URL for a named route.

string
temporarySignedRoute(BackedEnum|string $name, DateInterval|DateTimeInterface|int $expiration, array $parameters = [], bool $absolute = true)

Create a temporary signed route URL for a named route.

string
query(string $path, array $query = [], array|string $extra = [], bool|null $secure = null)

Generate an absolute URL with the given query parameters.

string
action(array|string $action, array|string $parameters = [], bool $absolute = true)

Get the URL to a controller action.

string|null
getRootControllerNamespace()

Get the root controller namespace.

setRootControllerNamespace(string $rootNamespace)

Set the root controller namespace.

Details

at line 17
string current()

Get the current URL for the request.

Return Value

string

at line 22
string previous(bool|string $fallback = false)

Get the URL for the previous request.

Parameters

bool|string $fallback

Return Value

string

at line 27
string to(string $path, array|string $extra = [], bool|null $secure = null)

Generate an absolute URL to the given path.

Parameters

string $path
array|string $extra
bool|null $secure

Return Value

string

at line 32
string secure(string $path, array $parameters = [])

Generate a secure, absolute URL to the given path.

Parameters

string $path
array $parameters

Return Value

string

at line 37
string asset(string $path, bool|null $secure = null)

Generate the URL to an application asset.

Parameters

string $path
bool|null $secure

Return Value

string

at line 44
string route(BackedEnum|string $name, mixed $parameters = [], bool $absolute = true)

Get the URL to a named route.

Parameters

BackedEnum|string $name
mixed $parameters
bool $absolute

Return Value

string

Exceptions

InvalidArgumentException

at line 51
string signedRoute(BackedEnum|string $name, mixed $parameters = [], DateInterval|DateTimeInterface|int|null $expiration = null, bool $absolute = true)

Create a signed route URL for a named route.

Parameters

BackedEnum|string $name
mixed $parameters
DateInterval|DateTimeInterface|int|null $expiration
bool $absolute

Return Value

string

Exceptions

InvalidArgumentException

at line 56
string temporarySignedRoute(BackedEnum|string $name, DateInterval|DateTimeInterface|int $expiration, array $parameters = [], bool $absolute = true)

Create a temporary signed route URL for a named route.

Parameters

BackedEnum|string $name
DateInterval|DateTimeInterface|int $expiration
array $parameters
bool $absolute

Return Value

string

at line 61
string query(string $path, array $query = [], array|string $extra = [], bool|null $secure = null)

Generate an absolute URL with the given query parameters.

Parameters

string $path
array $query
array|string $extra
bool|null $secure

Return Value

string

at line 66
string action(array|string $action, array|string $parameters = [], bool $absolute = true)

Get the URL to a controller action.

Parameters

array|string $action
array|string $parameters
bool $absolute

Return Value

string

at line 71
string|null getRootControllerNamespace()

Get the root controller namespace.

Return Value

string|null

at line 78
UrlGenerator setRootControllerNamespace(string $rootNamespace)

Set the root controller namespace.

Parameters

string $rootNamespace

Return Value

UrlGenerator