Class MiddlewareFactory
Marshal middleware for use in the application.
This class provides a number of methods for preparing and returning middleware for use within an application.
If any middleware provided is already a MiddlewareInterface, it can be used verbatim or decorated as-is. Other middleware types acceptable are:
Additionally, the class provides the following decorator/utility methods:
package |
LightMVC/ASCMVC |
---|
__construct(\Pimple\Container $container)
\Pimple\Container
callableMiddleware(callable $middleware) : \Zend\Stratigility\Middleware\CallableMiddlewareDecorator
callable
\Zend\Stratigility\Middleware\CallableMiddlewareDecorator
handlerMiddleware(\Psr\Http\Server\RequestHandlerInterface $handler) : \Zend\Stratigility\Middleware\RequestHandlerMiddleware
\Psr\Http\Server\RequestHandlerInterface
\Zend\Stratigility\Middleware\RequestHandlerMiddleware
lazyMiddleware(string $middleware) : \Ascmvc\Middleware\LazyLoadingMiddleware
pipeline(string|array|\Zend\Stratigility\MiddlewarePipe $middleware) : \Zend\Stratigility\MiddlewarePipe
This method allows passing an array of middleware as either:
Each item is passed to prepare() before being passed to the MiddlewarePipe instance the method returns.
Throws |
|
---|
string|array|\Zend\Stratigility\MiddlewarePipe
\Zend\Stratigility\MiddlewarePipe
prepare(string|array|callable|\Psr\Http\Server\MiddlewareInterface|\Psr\Http\Server\RequestHandlerInterface $middleware) : \Psr\Http\Server\MiddlewareInterface
Throws |
|
---|
string|array|callable|\Psr\Http\Server\MiddlewareInterface|\Psr\Http\Server\RequestHandlerInterface
\Psr\Http\Server\MiddlewareInterface
container : \Pimple\Container
var |
---|
\Pimple\Container