RouteUrlGenerator
class RouteUrlGenerator
Constants
| protected PARAMETER_ESCAPES |
Characters that must remain encoded within route parameter values. The final URI pass restores only the outer percent escape around these values; the $dontEncode map still owns structural URL syntax outside parameters. Brace escapes keep substituted data from being rescanned as route placeholders. |
Properties
| protected UrlGenerator | $url | The URL generator instance. |
|
| array | $defaultParameters | The global named parameter defaults. |
|
| array | $dontEncode | Characters that should not be URL-encoded. |
Methods
Format the array of route parameters.
Replace the parameters on the root path.
Replace the port in a root URL with the route's configured port.
Replace all of the wildcard parameters for a route path.
Replace all of the named parameters in the path.
Encode a parameter value that is being substituted into a route URI.
Add a query string to the URI.
Get the query string for a given route.
Get the string parameters from a given list.
Get the numeric parameters from a given list.
Set the default named parameters used by the URL generator.
Details
at line 68
__construct(UrlGenerator $url)
Create a new route URL generator.
at line 78
string
to(Route $route, mixed $parameters = [], bool $absolute = false)
Generate a URL for the given route.
at line 119
protected string|null
getRouteDomain(Route $route, array $parameters)
Get the formatted domain for a given route.
at line 127
protected string
formatDomain(Route $route, array $parameters)
Format the domain and port for the route and request.
at line 138
protected string
getRouteScheme(Route $route)
Get the scheme for the given route.
at line 153
protected string
addPortToDomain(string $domain, Route|null $route = null)
Add the port to the domain if necessary.
at line 169
protected bool
isRouteSecure(Route $route)
Determine if the route uses HTTPS.
at line 185
protected array
formatParameters(Route $route, mixed $parameters, array $defaultParameters)
Format the array of route parameters.
at line 315
protected string
replaceRootParameters(Route $route, string|null $domain, array $parameters, array $defaultParameters)
Replace the parameters on the root path.
at line 343
protected string
replacePortInRoot(string $root, Route $route)
Replace the port in a root URL with the route's configured port.
at line 363
protected string
replaceRouteParameters(string $path, array $parameters, array $rootDefaultParameters)
Replace all of the wildcard parameters for a route path.
at line 385
protected string
replaceNamedParameters(string $path, array $parameters, array $rootDefaultParameters)
Replace all of the named parameters in the path.
at line 412
protected mixed
encodeParameter(mixed $value)
Encode a parameter value that is being substituted into a route URI.
Values wrapped in an EncodedParameter are already URL-encoded and are used as-is.
at line 426
protected string
addQueryString(string $uri, array $parameters)
Add a query string to the URI.
at line 443
protected string
getRouteQueryString(array $parameters)
Get the query string for a given route.
at line 474
protected array
getStringParameters(array $parameters)
Get the string parameters from a given list.
at line 482
protected array
getNumericParameters(array $parameters)
Get the numeric parameters from a given list.
at line 490
void
defaults(array $defaults)
Set the default named parameters used by the URL generator.