2017 © Pedro Peláez
 

library whoops

Middleware to use Whoops as error handler

image

middlewares/whoops

Middleware to use Whoops as error handler

  • Wednesday, May 23, 2018
  • by oscarotero
  • Repository
  • 2 Watchers
  • 8 Stars
  • 25,168 Installations
  • PHP
  • 12 Dependents
  • 1 Suggesters
  • 3 Forks
  • 0 Open issues
  • 12 Versions
  • 24 % Grown

The README.md

middlewares/whoops

Latest Version on Packagist ![Software License][ico-license] Testing ![Total Downloads][ico-downloads], (*1)

Middleware to use Whoops as error handler., (*2)

Requirements

Installation

This package is installable and autoloadable via Composer as middlewares/whoops., (*3)

composer require middlewares/whoops

Example

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

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

Usage

The constructor accepts a Whoops\Run instance but creates one automatically if it's not provided. Optionally, you can provide a Psr\Http\Message\ResponseFactoryInterface as the second argument to create the response. If it's not defined, Middleware\Utils\Factory will be used to detect it automatically., (*4)

$whoops = new Whoops\Run();
$responseFactory = new MyOwnResponseFactory();

//Create a Run instance automatically
$middleware = new Middlewares\Whoops();

//Pass your own Run instance
$middleware = new Middlewares\Whoops($whoops);

//Pass a Run instance and ResponseFactory
$middleware = new Middlewares\Whoops($whoops, $responseFactory);

catchErrors

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);, (*5)

//Do not catch errors
$middleware = (new Middlewares\Whoops())->catchErrors(false);

handlerContainer

This option allows to define a custom PSR-11 container used to create the intance of Whoops\Handler\HandlerInterface based in the Accept header in the request., (*6)


Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details., (*7)

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

The Versions

26/01 2018
21/09 2017
21/09 2017
26/06 2017

v0.4.1

0.4.1.0 https://github.com/middlewares/whoops

Middleware to use Whoops as error handler

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 server http error whoops psr-15

22/06 2017

dev-fatal-error-bug

dev-fatal-error-bug https://github.com/middlewares/whoops

Middleware to use Whoops as error handler

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 server http error whoops psr-15

18/03 2017

v0.4.0

0.4.0.0 https://github.com/middlewares/whoops

Middleware to use Whoops as error handler

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 server http error whoops psr-15

26/12 2016

v0.3.0

0.3.0.0 https://github.com/middlewares/whoops

Middleware to use Whoops as error handler

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 server http error whoops psr-15

22/11 2016

v0.2.0

0.2.0.0 https://github.com/middlewares/whoops

Middleware to use Whoops as error handler

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 server http error whoops psr-15