MiddlewareDispatcher implements RequestHandlerInterface
MiddlewareDispatcher
This class manages and dispatches a PSR-15 middleware stack.
Table of Contents
Interfaces
- RequestHandlerInterface
Properties
- $container : ContainerInterface|null
- $tip : RequestHandlerInterface
- Tip of the middleware call stack
Methods
- __construct() : mixed
- add() : mixed
- Add a new middleware to the stack
- handle() : ResponseInterface
- Invoke the middleware stack
- lazy() : void
- Add a new middleware by class name
- seedMiddlewareStack() : mixed
- Seed the middleware stack with the inner request handler
Properties
$container
        protected
            ContainerInterface|null
    $container
    
    
    
    
    
    
$tip
Tip of the middleware call stack
        protected
            RequestHandlerInterface
    $tip
    
    
    
    
    
    
Methods
__construct()
    public
                    __construct(RequestHandlerInterface $kernel[, iterable<string|int, mixed> $middlewares = [] ][, ContainerInterface|null $container = null ]) : mixed
    Parameters
- $kernel : RequestHandlerInterface
- $middlewares : iterable<string|int, mixed> = []
- $container : ContainerInterface|null = null
add()
Add a new middleware to the stack
    public
                    add(MiddlewareInterface $middleware) : mixed
    Middlewares are organized as a stack. That means middlewares that have been added before will be executed after the newly added one (last in, first out).
Parameters
- $middleware : MiddlewareInterface
handle()
Invoke the middleware stack
    public
                    handle(ServerRequestInterface $request) : ResponseInterface
    Parameters
- $request : ServerRequestInterface
Return values
ResponseInterfacelazy()
Add a new middleware by class name
    public
                    lazy(string $middleware) : void
    Middlewares are organized as a stack. That means middlewares that have been added before will be executed after the newly added one (last in, first out).
Parameters
- $middleware : string
seedMiddlewareStack()
Seed the middleware stack with the inner request handler
    protected
                    seedMiddlewareStack(RequestHandlerInterface $kernel) : mixed
    Parameters
- $kernel : RequestHandlerInterface