Skip to content
docsv0.1.0

RouterInterface

Matches a PSR-7 request against the route table. A pure function of the request: it never throws for a miss and never constructs a response — a 404 or 405 is the expected {@see RouteResult}, not an exception. How routes are registered (attribute scanning, config, code) is deliberately an implementation concern, kept out of this contract.

RouterInterface::match()

abstract public function match(Psr\Http\Message\ServerRequestInterface $request): Milpa\Http\Routing\RouteResult

Resolve the request to a typed result — always MATCHED, NOT_FOUND or METHOD_NOT_ALLOWED, never null.

Parameters

Parameters of match()
NameTypeDescription
$requestPsr\Http\Message\ServerRequestInterface