for/http-middleware-psr15-adapter
最新稳定版本:v2.0.0
Composer 安装命令:
composer require for/http-middleware-psr15-adapter
包简介
PSR15 adapter for react/http middleware
README 文档
README
Wraps PSR-15 middleware using async and await from react/async utilizing fibers making them usable within react/http as middleware.
Install
To install via Composer, use the command below, it will automatically detect the latest version and bind it with ^.
composer require for/http-middleware-psr15-adapter
Usage
The following usage example uses middlewares/redirect adding one redirect,
and using the callback to call several methods on the redirect middleware to change it's behavior:
$server = new Server( /** Other middleware */ new PSR15Middleware( (new Redirect(['/old-url' => '/new-url']))->permanent(false)->query(false)->method(['GET', 'POST']) ), /** Other middleware */ );
Grouped Usage
When using more then one PSR-15 in a row the GroupedPSR15Middleware is more performing than using multiple PSR15Middleware. Consider the
following example where we add middlewares/cache for expires headers:
$loop = Factory::create(); $server = new Server([ /** Other middleware */ (new GroupedPSR15Middleware($loop))->withMiddleware( (new Redirect(['/old-url' => '/new-url']))->permanent(false)->query(false)->method(['GET', 'POST']) )->withMiddleware( new Expires() ), /** Other middleware */ ]);
统计信息
- 总下载量: 12.34k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 25
- 点击次数: 1
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-08-13