jowy / exception-handling-middleware
PSR7 Http Exception Handling Middleware
Installs: 70
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Type:middleware
pkg:composer/jowy/exception-handling-middleware
Requires
- filp/whoops: ^1.1
- psr/log: ^1.0
- zendframework/zend-diactoros: ^1.0
- zendframework/zend-stratigility: ^1.0
Requires (Dev)
- henrikbjorn/phpspec-code-coverage: ^1.0
- phpspec/phpspec: ^2.2
Conflicts
- symfony/http-kernel: >=2.0
This package is not auto-updated.
Last update: 2025-10-25 23:11:17 UTC
README
PSR 7 error handling middleware
Intallation & Requirements
Install using composer
$ composer require jowy/error-handling-middleware
This library has following dependencies:
- zendframework/zend-diactoros, used for PSR 7 implementation
- zendframework/zend-stratigility, provide abstraction for PSR 7 middleware
- flip/whoops, used for error formatting
- psr/log, provide abstration for logging
This library has conflict with following library:
- symfony/http-kernel, because this library has already used- Symfony\Component\HttpKernel\Exception, despite require whole- symfony/http-kernelpackage it only require the exception class
Usage
Usage on zendframework/zend-stratigility
use Zend\Stratigility\MiddlewarePipe; use Jowy\ExceptionHandler\ExceptionHandler; $app = new MiddlewarePipe(); $route_middleware = new ExceptionHandler($whoops_output_handler, $psr3_logger, $catch); $app->pipe($route_middleware);
Usage on relay\relay
use Pimple\Container; use Relay\Relay; use Jowy\ExceptionHandler\ExceptionHandler; $container = new Container(); $container["middleware"] = [ ExceptionHandler::class => function() { return new ExceptionHandler($whoops_output_handler, $psr3_logger, $catch); } ]; $resolver = function ($class) use ($container) { return $container[$class]; } new Relay(array_keys($container["middleware"], $resolver);
API
use Psr\Log\LoggerInterface; use Whoops\Handler\HandlerInterface; class ExceptionHandler { public function __construct(HandlerInterface $error_handler, LoggerInterface $logger, $catch = true); }
License
MIT, see LICENSE.