whoops README

The project's README from github.com/filp/whoops. As one markdown file: README.md.

whoops

PHP errors for cool kids

Total Downloads Latest Version Build Status on newer versions Scrutinizer Quality Score Code Coverage


Whoops!

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

Sponsors

Blackfire.io Oblak Host

Installing

If you use Laravel 4, Laravel 5.5+, Mezzio or ZubZet 1.2+, 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:

  1. Use Composer to install Whoops into your project:

    composer require filp/whoops
    
  2. 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:

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.

whoops (filp/whoops)

Searching Database…

13.2K ·GitHub
What is this?whoops is an error handler framework for PHP: when something breaks in your web project, it shows a pretty error page instead of a raw stack trace, built on a stacked error handling system.
Is this a library I add to my project, or a tool I run on its own?A library: it calls itself an error handler framework, but you install it into your PHP project and register handlers in your own code — it is not a separate app or service.
How do I get it running?Install it with Composer and register the pretty page handler in your code. If you use Laravel 4, Laravel 5.5+, Mezzio or ZubZet 1.2+, it is already bundled and there is nothing to install.
Does it drag any dependencies into my project?No — whoops is a stand-alone library with no required dependencies, and it is designed to be easy to extend and integrate with existing libraries.
What if the error happens in an AJAX request or a CLI script?It ships handlers for different response formats: JsonResponseHandler and XmlResponseHandler return exception info as JSON or XML for AJAX requests, and PlainTextHandler outputs plain text for CLI applications.
Do I have to wire it into my framework myself?Not always: Laravel 4, Laravel 5.5+, Mezzio and ZubZet 1.2+ already include it, and there are community guides for Silex, Phalcon, CakePHP, Zend, Yii, Slim, Laminas and anything built on StackPHP or PSR-7 middlewares.
Can I add my own error handler?Yes — handlers are stacked: push your own closure or callable and whoops wraps it automatically. You can also override system calls by extending the SystemFacade class, or collect the generated HTML to process it yourself.
Can it open the file where the error happened in my editor?Yes — one of its built-in features is the ability to open referenced files directly in your editor and IDE straight from the error page.
What are similar projects?monolog, guzzle, echo, axum, martini, Slim, jwt-auth, loguru
Creator
filp
Size
1.7 MB
Stars
13.2K
Updated
CommitOct 03
Age
13y
Commits · 90 Days