mehr-it/eli-middleware-chain
Composer 安装命令:
composer require mehr-it/eli-middleware-chain
包简介
Chaining for PSR-15 middleware
README 文档
README
When defining a request processing chain, usually more than one middleware is involved into the
processing chain. The ChainHandler allows to define the PSR-15 middleware processing stack as
array or iterator:
$chain = new ChainHandler([
new MiddlewareA(),
new MiddlewareB(),
], $next);
This makes code much more readable and allows easy dynamic configuration of the middleware chain.
To create middleware instances on the fly - only when needed - resolver functions may be used:
$chain = new ChainHandler([
function() { return new MiddlewareA(); },
function() { return new MiddlewareB(); },
], $next);
Middleware instead of handler
Sometimes a middleware chain is required as middleware itself. The ChainMiddleware can be used
for such purposes. It's usage is straightforward as the ChainHandler:
$chain = new ChainMiddleware([
new MiddlewareA(),
new MiddlewareB(),
]);
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-08