Fork me on GitHub

whoops

php errors for cool kids

whoops is a nice little library that helps you develop and maintain your projects better, by helping you deal with errors and exceptions in a less painful way.

Features

Download

With Composer:

{
  "require": {
    "filp/whoops": "2.*"
  }
}
$ cd my_project
$ composer install

Use

In your Silex project, register the bundled Service Provider:

$app->register(new Whoops\Provider\Silex\WhoopsServiceProvider);

For integration instructions with other frameworks or platforms, check out the README file.

Or if you'd rather take control, integrate it manually and tweak it to fit your needs:

require __DIR__ . "/vendor/autoload.php";

$run     = new \Whoops\Run;
$handler = new \Whoops\Handler\PrettyPageHandler;

// Add some custom tables with relevant info about your application,
// that could prove useful in the error page:
$handler->addDataTable('Killer App Details', array(
  "Important Data" => $myApp->getImportantData(),
  "Thingamajig-id" => $someId
));

// Set the title of the error page:
$handler->setPageTitle("Whoops! There was a problem.");

$run->pushHandler($handler);

// Add a special handler to deal with AJAX requests with an
// equally-informative JSON response. Since this handler is
// first in the stack, it will be executed before the error
// page handler, and will have a chance to decide if anything
// needs to be done.
if (\Whoops\Util\Misc::isAjaxRequest()) {
  $run->pushHandler(new \Whoops\Handler\JsonResponseHandler);
}

// Register the handler with PHP, and you're set!
$run->register();

Learn More & Contribute

API Documentation is available here. If you need any help, or want to give us a hand with the project, have a look at the repository!

whoops on github

Thank you for stopping by!