bermudaphp/error-handler

v3.0.0 2025-03-31 00:55 UTC

This package is auto-updated.

Last update: 2025-03-31 00:55:57 UTC


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));