filp / damnit
php error handling for cool kids
Fund package maintenance!
denis-sokolov
Installs: 223
Dependents: 0
Suggesters: 0
Security: 0
Stars: 13 191
Watchers: 191
Forks: 604
Open Issues: 5
Requires
- php: ^7.1 || ^8.0
- psr/log: ^1.0.1 || ^2.0 || ^3.0
Requires (Dev)
- mockery/mockery: ^1.0
- phpunit/phpunit: ^7.5.20 || ^8.5.8 || ^9.3.3
- symfony/var-dumper: ^4.0 || ^5.0
Suggests
- symfony/var-dumper: Pretty print complex values better with var-dumper available
- whoops/soap: Formats errors as SOAP responses
- 2.16.0
- 2.15.4
- 2.15.3
- 2.15.2
- 2.15.1
- 2.15.0
- 2.14.6
- 2.14.5
- 2.14.4
- 2.14.3
- 2.14.2
- 2.14.1
- 2.14.0
- 2.13.0
- 2.12.1
- 2.12.0
- 2.11.0
- 2.10.0
- 2.9.2
- 2.9.1
- 2.9.0
- 2.8.0
- dev-master / 2.7.x-dev
- 2.7.3
- 2.7.2
- 2.7.1
- 2.7.0
- 2.6.0
- 2.5.1
- 2.5.0
- 2.4.1
- 2.4.0
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.1
- 2.2.0
- 2.1.14
- 2.1.13
- 2.1.12
- 2.1.11
- 2.1.10
- 2.1.9
- 2.1.8
- 2.1.7
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.0
- 2.0.0-alpha2
- 2.0.0-alpha1
- 1.x-dev
- 1.1.10
- 1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1
- 1.1-rc
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.1
- 1.0.0
- 0.9.0
- 0.8.4
- dev-feature/frame-args
This package is not auto-updated.
Last update: 2024-11-23 15:19:25 UTC
README
PHP errors for cool kids
whoops is an error handler framework for PHP. Out-of-the-box, it provides a pretty error interface that helps you debug your web projects, but at heart it's a simple yet powerful stacked error handling system.
Features
- Flexible, stack-based error handling
- Stand-alone library with (currently) no required dependencies
- Simple API for dealing with exceptions, trace frames & their data
- Includes a pretty rad error page for your webapp projects
- Includes the ability to open referenced files directly in your editor and IDE
- Includes handlers for different response formats (JSON, XML, SOAP)
- Easy to extend and integrate with existing libraries
- Clean, well-structured & tested code-base
Sponsors
Installing
If you use Laravel 4, Laravel 5.5+ or Mezzio, you already have Whoops. There are also community-provided instructions on how to integrate Whoops into Silex 1, Silex 2, Phalcon, Laravel 3, Laravel 5, CakePHP 3, CakePHP 4, Zend 2, Zend 3, Yii 1, FuelPHP, Slim, Pimple, Laminas, or any framework consuming StackPHP middlewares or PSR-7 middlewares.
If you are not using any of these frameworks, here's a very simple way to install:
-
Use Composer to install Whoops into your project:
composer require filp/whoops
-
Register the pretty handler in your code:
$whoops = new \Whoops\Run; $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler); $whoops->register();
For more options, have a look at the example files in examples/
to get a feel for how things work. Also take a look at the API Documentation and the list of available handlers below.
You may also want to override some system calls Whoops does. To do that, extend Whoops\Util\SystemFacade
, override functions that you want and pass it as the argument to the Run
constructor.
You may also collect the HTML generated to process it yourself:
$whoops = new \Whoops\Run; $whoops->allowQuit(false); $whoops->writeToOutput(false); $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler); $html = $whoops->handleException($e);
Available Handlers
whoops currently ships with the following built-in handlers, available in the Whoops\Handler
namespace:
PrettyPageHandler
- Shows a pretty error page when something goes pants-upPlainTextHandler
- Outputs plain text message for use in CLI applicationsCallbackHandler
- Wraps a closure or other callable as a handler. You do not need to use this handler explicitly, whoops will automatically wrap any closure or callable you pass toWhoops\Run::pushHandler
JsonResponseHandler
- Captures exceptions and returns information on them as a JSON string. Can be used to, for example, play nice with AJAX requests.XmlResponseHandler
- Captures exceptions and returns information on them as a XML string. Can be used to, for example, play nice with AJAX requests.
You can also use pluggable handlers, such as SOAP handler.
Authors
This library was primarily developed by Filipe Dobreira, and is currently maintained by Denis Sokolov. A lot of awesome fixes and enhancements were also sent in by various contributors. Special thanks to Graham Campbell and Markus Staab for continuous participation.