Applies routing rules to the request and creates the controller instance if possible.
string
'routeCollection'
\Cake\Routing\RoutingApplicationInterface
The application that will have its routing hook invoked.
string|null
The cache configuration name to use for route collection caching, null to disable caching
Check if route cache is enabled and use the configured Cache to 'remember' the route collection
Trigger the application's routes() hook if the application exists and Router isn't initialized.
__construct(\Cake\Routing\RoutingApplicationInterface $app, ?string $cacheConfig)
Constructor
\Cake\Routing\RoutingApplicationInterface
$app The application instance that routes are defined on.
string|null
$cacheConfig optional The cache config name to use or null to disable routes cache
buildRouteCollection()
Check if route cache is enabled and use the configured Cache to 'remember' the route collection
\Cake\Routing\RouteCollection
loadRoutes()
Trigger the application's routes() hook if the application exists and Router isn't initialized.
Uses the routes cache if enabled via configuration param "Router.cache"
If the middleware is created without an Application, routes will be loaded via the automatic route loading that pre-dates the routes() hook.
prepareRouteCollection()
Generate the route collection using the builder
\Cake\Routing\RouteCollection
process(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Server\RequestHandlerInterface $handler)
Apply routing and update the request.
Any route/path specific middleware will be wrapped around $next and then the new middleware stack will be invoked.
\Psr\Http\Message\ServerRequestInterface
$request The request.
\Psr\Http\Server\RequestHandlerInterface
$handler The request handler.
\Psr\Http\Message\ResponseInterface
A response.
The application that will have its routing hook invoked.
\Cake\Routing\RoutingApplicationInterface
The cache configuration name to use for route collection caching, null to disable caching
string|null
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.Routing.Middleware.RoutingMiddleware.html