Router
The family's reference {@see RouterInterface} implementation: exact path segments plus single-segment `{placeholder}` parameters. Never throws, never returns null — a {@see RouteResult} always carries the outcome, exactly as the contract demands. A trailing slash is normalized away before matching (`/posts/` and `/posts` are the same route), and the root path always matches as `/`. Route order matters for the `Allow` header on a method miss: every route whose path matches the request, regardless of method, contributes its verbs to the eventual {@see MatchStatus::METHOD_NOT_ALLOWED} result.
Router::__construct()
public function __construct(Milpa\Http\Routing\Route ...$routes):Parameters
| Name | Type | Description |
|---|---|---|
| $routes | Route | the route table, in match priority order |
Router::match()
public function match(Psr\Http\Message\ServerRequestInterface $request): Milpa\Http\Routing\RouteResultResolves the request to a typed result — always MATCHED, NOT_FOUND or METHOD_NOT_ALLOWED, never null.
Parameters
| Name | Type | Description |
|---|---|---|
| $request | Psr\Http\Message\ServerRequestInterface |