hakone / middleware-dispatcher
轻量级PSR-15中间件分发器
0.1.0
2023-03-09 18:04 UTC
Requires
- php: >=7.3
- hakone/untouchable-psr7: ^0.2.0
- psr/http-server-middleware: ^1.0
Requires (Dev)
- nyholm/psr7: ^1.5
- nyholm/psr7-server: ^1.0
- phpstan/phpstan: ^1.10
- phpstan/phpstan-phpunit: ^1.3
- phpstan/phpstan-strict-rules: ^1.5
- phpunit/phpunit: ^9.6
- symplify/easy-coding-standard: ^11.2
This package is auto-updated.
Last update: 2024-09-04 12:07:57 UTC
README
Hakone是一个轻量级的PSR-15中间件分发器实现。它受到Relay的启发。
概念
PSR-15旨在设计成通用中间件。所有中间件都可以在请求和响应中干预。
Hakone是PSR-15元文档中描述的“基于队列的请求处理器”。基于队列的缺点是,中间件越多,堆栈跟踪就越堆叠。
我们编写了多个小任务中间件,但许多情况下它们仅在请求或响应上执行工作。我们决定将中间件类型分为三类:“请求拦截器”、“通用中间件”和“响应装饰器”。
如何使用
$dispatcher = Hakone\relay([ 'interceptors' => [ // ... ], 'middlewares' => [ // ... ], 'handler' => $handler 'decorators' => [ // ... ], ]);
版权
Copyright 2023 USAMI Kenta <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.