php-middleware / double-pass-compatibility
Tools for support double pass middewares in PSR-15
Installs: 127 866
Dependents: 5
Suggesters: 1
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 2
Requires
- php: >=5.6
- http-interop/http-middleware: ^0.4.1
- psr/http-message: ^1.0
Requires (Dev)
- phpunit/phpunit: ^5.6 || ^6.1
This package is not auto-updated.
Last update: 2024-10-27 02:41:28 UTC
README
This package provide trait and abstract class for your psr-15 middlewares to double pass middewares support. So you can call your middleware in both styles.
Standard PSR-15 call:
$middleware->process($request, $delegate);
Possible call after implements this package:
$middleware($request, $response, $next);
Installation
composer require php-middleware/double-pass-compatibility
You can add trait into your middeware:
class Middleware implements MiddlewareInterface { use PhpMiddleware\DoublePassCompatibilityTrait; public function process(ServerRequestInterface $request, DelegateInterface $delegate) { // Implementation and return response } }
Or extend abstract class:
class Middleware extend AbstractDoublePassCompatibilityMiddleware implements MiddlewareInterface { public function process(ServerRequestInterface $request, DelegateInterface $delegate) { // Implementation and return response } }