Documentation

DecoratingRequestHandler
in package
implements RequestHandlerInterface

The decorating request handler allows to bind middleware to another request handler, effectively stacking them together.

Tags
see
https://www.php-fig.org/psr/psr-15/meta/

Interfaces, Classes and Traits

RequestHandlerInterface

Table of Contents

$handler  : RequestHandlerInterface
The wrapped handler. If the middleware cannot process the request on it's own, or just provides filtering, this handler will receive the request from the middleware.
$middleware  : MiddlewareInterface
The middleware to "wrap" around the request handler, allowing the middleware to be executed before the underlying handler.
__construct()  : mixed
Creates a new decorating request handler, which wraps a requesthandler with a middleware so the middleware can intercept the request.
handle()  : ResponseInterface
Use the middleware, the undelying handler, or a combination of both to handle the request.

Properties

$handler

The wrapped handler. If the middleware cannot process the request on it's own, or just provides filtering, this handler will receive the request from the middleware.

private RequestHandlerInterface $handler

$middleware

The middleware to "wrap" around the request handler, allowing the middleware to be executed before the underlying handler.

private MiddlewareInterface $middleware

Methods

__construct()

Creates a new decorating request handler, which wraps a requesthandler with a middleware so the middleware can intercept the request.

public __construct(RequestHandlerInterface $handler, MiddlewareInterface $middleware) : mixed
Parameters
$handler : RequestHandlerInterface
$middleware : MiddlewareInterface
Return values
mixed

handle()

Use the middleware, the undelying handler, or a combination of both to handle the request.

public handle(ServerRequestInterface $request) : ResponseInterface
Parameters
$request : ServerRequestInterface
Return values
ResponseInterface

Search results