procurios/middleware-dispatcher
最新稳定版本:2.0.1
Composer 安装命令:
composer require procurios/middleware-dispatcher
包简介
Simple PSR-15 compliant middleware dispatcher.
README 文档
README
Simple PSR-15 compliant middleware dispatcher
Goal
The goal of this library is to provide a minimal implementation of the PSR-15 specification that is compatible with older callback middleware.
Installation
composer require procurios/middleware-dispatcher
Usage
See PSR-15 for detailed information about middleware dispatchers.
use Procurios\Http\MiddlewareDispatcher\Dispatcher; $dispatcher = (new Dispatcher($myFallbackHandler)) ->withMiddleware($myMiddleware) ->withMiddleware($myApp) ; $response = $dispatcher->handle($request);
Or add anonymous callback middleware:
use Procurios\Http\MiddlewareDispatcher\Dispatcher; $dispatcher = (new Dispatcher($myFallbackHandler)) ->withMiddleware($myMiddleware) ->withCallback(function (ServerRequestInterface $request, callable $next) { // noop return $next($request); }) ->withCallback(function (ServerRequestInterface $request, RequestHandlerInterface $handler) { // noop return $handler->handle($request); }) ->withMiddleware($myApp) ; $response = $dispatcher->handle($request);
统计信息
- 总下载量: 4.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-01