Esc
API Index — Namespaces, Packages, Reports, Indices
MiddlewareFrame
in package
implements
RequestHandlerInterface
FinalYes
One frame of a middleware onion: pairs a PSR-15 middleware with the
RequestHandler it wraps, so a chain can be assembled as nested handlers
(new MiddlewareFrame($m0, new MiddlewareFrame($m1, $terminal))). Calling
handle() runs the middleware's process(), handing it the inner handler as
$next. Stateless and cheap — a couple of object fields, no clone-per-step.
Shared by every middleware band in ZealPHP — per-route (middleware:),
route groups, path-scoped (App::when), and api in-file $middleware. The
terminal differs per band (RouteDispatchHandler, PathDispatchHandler,
ApiDispatchHandler); the frame is identical.
Table of Contents
Interfaces
- RequestHandlerInterface
Properties
- $middleware : MiddlewareInterface
- $next : RequestHandlerInterface
Methods
- __construct() : mixed
- handle() : ResponseInterface
Properties
$middleware
private
MiddlewareInterface
$middleware
$next
private
RequestHandlerInterface
$next
Methods
__construct()
public
__construct(MiddlewareInterface $middleware, RequestHandlerInterface $next) : mixed
Parameters
- $middleware : MiddlewareInterface
- $next : RequestHandlerInterface
handle()
public
handle(ServerRequestInterface $request) : ResponseInterface
Parameters
- $request : ServerRequestInterface