Skip to content

The ErrorHandler middleware handles errors and generates a psr-7 compliant response

License

Notifications You must be signed in to change notification settings

bermudaphp/error-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Install

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

About

The ErrorHandler middleware handles errors and generates a psr-7 compliant response

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages