Applies routing rules to the request and creates the controller instance if possible.
string 'routeCollection'
Key used to store the route collection in the cache engine
Cake\Routing\RoutingApplicationInterfaceThe application that will have its routing hook invoked.
string|nullThe cache configuration name to use for route collection caching, null to disable caching
Constructor
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. Uses the routes cache if enabled via configuration param "Router.cache"
Generate the route collection using the builder
Apply routing and update the request.
__construct(Cake\Routing\RoutingApplicationInterface $app, string|null $cacheConfig = null)
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(): Cake\Routing\RouteCollection
Check if route cache is enabled and use the configured Cache to 'remember' the route collection
Cake\Routing\RouteCollectionloadRoutes(): void
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.
voidprepareRouteCollection(): Cake\Routing\RouteCollection
Generate the route collection using the builder
Cake\Routing\RouteCollectionprocess(ServerRequestInterface $request, RequestHandlerInterface $handler): Psr\Http\Message\ResponseInterface
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.
ServerRequestInterface $request The request.
RequestHandlerInterface $handler The request handler.
Psr\Http\Message\ResponseInterfaceThe application that will have its routing hook invoked.
Cake\Routing\RoutingApplicationInterfaceThe 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.4/class-Cake.Routing.Middleware.RoutingMiddleware.html