Class MiddlewareApplication
Base class for standalone HTTP applications
Provides a base class to inherit from for applications using only the http package. This class defines a fallback handler that renders a simple 404 response.
You can overload the handle
method to provide your own logic
to run when no middleware generates a response.
Method Summary
-
bootstrap() abstract public
Load all the application configuration and bootstrap logic.
-
handle() public
Generate a 404 response as no middleware handled the request.
-
middleware() abstract public
Define the HTTP middleware layers for an application.
Method Detail
bootstrap() ¶ abstract public
bootstrap(): void
Load all the application configuration and bootstrap logic.
Override this method to add additional bootstrap logic for your application.
Returns
void
handle() ¶ public
handle(ServerRequestInterface $request): Psr\Http\Message\ResponseInterface
Generate a 404 response as no middleware handled the request.
May call other collaborating code to generate the response.
Parameters
-
ServerRequestInterface
$request The request
Returns
Psr\Http\Message\ResponseInterface
middleware() ¶ abstract public
middleware(Cake\Http\MiddlewareQueue $middlewareQueue): Cake\Http\MiddlewareQueue
Define the HTTP middleware layers for an application.
Parameters
-
Cake\Http\MiddlewareQueue
$middlewareQueue
Returns
Cake\Http\MiddlewareQueue