Class RoutingMiddleware
Applies routing rules to the request and creates the controller instance if possible.
Properties summary
-
$app
protected
Method Summary
- __construct() publicConstructor
- __invoke() publicApply routing and update the request.
- loadRoutes() protectedTrigger the application's routes() hook if the application exists and Router isn't initialized.
Method Detail
__construct()source public
__construct( Cake\Http\BaseApplication $app null )
Constructor
Parameters
-
Cake\Http\BaseApplication
$app
optional null - The application instance that routes are defined on.
__invoke()source public
__invoke( Psr\Http\Message\ServerRequestInterface $request , Psr\Http\Message\ResponseInterface $response , callable $next )
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\ResponseInterfaceA response.
loadRoutes()source protected
loadRoutes( )
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.
Properties detail
$appsource
protected Cake\Http\BaseApplication
The application that will have its routing hook invoked.
© 2005–2018 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/3.5/class-Cake.Routing.Middleware.RoutingMiddleware.html