RouteRegistry
in package
Static reverse route registry for standalone mode.
When routes are registered on the Laravel router (by RouteCollector or Kernel), they also register here so that url_for('@route_name?key=val') can reverse-resolve the named route to its URL pattern.
This replaces Symfony's sfRouting::generate() in standalone mode.
Table of Contents
Methods
- has() : bool
- Check if a named route is registered.
- register() : void
- Register a named route with its URL pattern.
- resolve() : string|null
- Resolve a named route to a URL, substituting parameters.
Methods
has()
Check if a named route is registered.
public
static has(string $name) : bool
Parameters
- $name : string
Return values
boolregister()
Register a named route with its URL pattern.
public
static register(string $name, string $urlPattern) : void
Parameters
- $name : string
-
Route name (e.g. 'actor_view_override')
- $urlPattern : string
-
URL pattern with {param} placeholders (e.g. '/actor/{slug}')
resolve()
Resolve a named route to a URL, substituting parameters.
public
static resolve(string $name[, array<string|int, mixed> $params = [] ]) : string|null
Parameters matching {placeholder} in the URL pattern are substituted into the path. Remaining parameters become query string.
Parameters
- $name : string
-
Route name
- $params : array<string|int, mixed> = []
-
Key-value pairs for substitution
Return values
string|null —Resolved URL or null if route not found