bermudaphp / error-handler
v3.0.0
2025-03-31 00:55 UTC
Requires
- php: ^8.4
- bermudaphp/config: ^1.4
- bermudaphp/eventor: ^1.3
- bermudaphp/http-contracts: ^1.1
- bermudaphp/http-emitter: ^1.0.1
- filp/whoops: ^2.18.0
- psr/http-factory: ^1.0.1
- psr/log: ^1.1.3 || ^2.0 || ^3.0
README
composer require bermudaphp/error-handler
Usage
$generator = new ErrorResponseGenerator($psr17ResponseFactory, new WhoopsErrorGenerator($psr17ResponseFactory)); $generator->addGenerator($myConcreteErrorResponseGenerator); $errorHandler = new ErrorHandlerMiddleware(new ErrorHandler($generator)); $pipeline->pipe($errorHandler); // Add ErrorHandlerMiddleware at the beginning of the middleware queue
Event listening
$errorHandler->listen(new Listener\LoggerListener($logger));