Middleware to use Whoops as error handler

v1.2.0 2018-08-04 10:41 UTC


Latest Version on Packagist Software License Build Status Quality Score Total Downloads SensioLabs Insight

Middleware to use Whoops as error handler.



This package is installable and autoloadable via Composer as middlewares/whoops.

composer require middlewares/whoops


$dispatcher = new Dispatcher([
	new Middlewares\Whoops()

$response = $dispatcher->dispatch(new ServerRequest());


__construct(Whoops\Run $whoops = null, Whoops\Util\SystemFacade $system = null)

Allows to provide a custom Whoops\Run instance. If it's not defined, creates an instance automatically. You can provide also the SystemFacade used by the Run instance, in order to implement a special behaviour with fatal errors.


To catch not only throwable exceptions, but also php errors. This makes whoops to be registered temporary in order to capture the errors using set_error_handler. It's enabled by default so, to disable it you have to use ->catchErrors(false);

handlerContainer(Psr\Container\ContainerInterface $container)

To define a custom PSR-11 container used to create the intance of Whoops\Handler\HandlerInterface based in the Accept header in the request.

responseFactory(Psr\Http\Message\ResponseFactoryInterface $responseFactory)

A PSR-17 factory to create the error response.

Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details.

The MIT License (MIT). Please see LICENSE for more information.