UrlGeneratorInterface
Reverse routing: build a URL for a named route from its parameters. Kept as its own interface (not bolted onto {@see RouterInterface}) to hold one responsibility per type — matching is request→route, generation is name→URI.
UrlGeneratorInterface::generate()
abstract public function generate(string $name, array $parameters = [], Milpa\Http\Routing\UrlReferenceType $referenceType = Milpa\Http\Routing\UrlReferenceType::ABSOLUTE_PATH): stringBuild the URL for a named route.
Parameters
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $parameters | array<string, (string | int)> | path-param values (surplus values become query string) |
| $referenceType | UrlReferenceType | how the reference is rendered |
Throws
RouteNotFoundException when no route is registered under $name
MissingRouteParametersException when a required path parameter is not supplied