Class RoutingMiddleware
Applies routing rules to the request and creates the controller instance if possible.
Property Summary
-
$app protected
Cake\Http\BaseApplication
The application that will have its routing hook invoked.
Method Summary
-
__construct() public
Constructor
-
__invoke() public
Apply routing and update the request.
-
loadRoutes() protected
Trigger the application's routes() hook if the application exists and Router isn't initialized.
Method Detail
__construct() ¶ public
__construct(Cake\Http\BaseApplication $app = null)
Constructor
Parameters
-
Cake\Http\BaseApplication
$app optional The application instance that routes are defined on.
__invoke() ¶ public
__invoke(Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next): 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.
Parameters
-
Psr\Http\Message\ServerRequestInterface
$request The request.
-
Psr\Http\Message\ResponseInterface
$response The response.
-
callable
$next The next middleware to call.
Returns
Psr\Http\Message\ResponseInterface
loadRoutes() ¶ protected
loadRoutes(): void
Trigger the application's routes() hook if the application exists and Router isn't initialized.
If the middleware is created without an Application, routes will be loaded via the automatic route loading that pre-dates the routes() hook.
Returns
void
Property Detail
$app ¶ protected
The application that will have its routing hook invoked.
Type
Cake\Http\BaseApplication