georgelemon/wups

Modern PHP Debugger


Keywords
library, exception, error, handling, whoops, throwable, wups, debugger, debugging-tool, development-tools, development-workflow, error-handler, php, php-library, whoops-error-handler
License
MIT

Documentation

Wups

Modern PHP Debugger for cool developers (Originally forked from Whoops).

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


Wups!

Wups 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.

Why Wups not Whoops? Wups is a modified version of Whoops.
First of, with Wups you get a nice modern dark theme by default (the light one is work in progress). All necessary Javascript is written in pure Vanilla.

Also, Wups will never disclose environment details. So, you can let the Wups Debugger ON even when you're in production. (which is not really recommended... really).

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
  • Modern dark theme
  • Light theme (todo tweaks)
  • Manual switcher

TODOS

  • Switching themes based on OS preference / Include manual switcher
  • Wups in Background App Monitoring, Error Tracking & Reporting Support

Installing

  1. Composer to go (not published yet):

    composer require georgelemon/wups
  2. Register the pretty handler in your code:

    $whoops = new \Wups\Run;
    $whoops->pushHandler(new \Wups\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 Wups does. To do that, extend Wups\Util\SystemFacade, override functions that you want and pass it as the argument to the Run constructor.

Switching themes

Since Wups you can choose from dark/light theme. By default, dark theme will be enabled. You can manually choose the theme by specifying 'dark', or 'light' to the THEME constant, like

/**
 * Default theme
 */
protected const THEME = 'dark';

Available Handlers

Wups, like it's predecessor (Whoops), ships with the following built-in handlers, available in the Wups\Handler namespace:

  • PrettyPageHandler - Shows a pretty error page when something goes pants-up
  • PlainTextHandler - Outputs plain text message for use in CLI applications
  • CallbackHandler - 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 to Whoops\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

Wups is maintained by George Lemon. Originally forked from Whoops, by Filipe Dobreira & 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.

This software includes Prettify, licensed under Apache License 2.0. It is bundled only as a performance optimization.