• Stars
    star
    13,093
  • Rank 2,261 (Top 0.05 %)
  • Language
    PHP
  • License
    MIT License
  • Created about 11 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PHP errors for cool kids

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

  • 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

Blackfire.io

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:

  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:

  • 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

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.

More Repositories

1

psdiff

Git hook to automagically render .PSD files to images, allowing you to visually diff changes.
Ruby
413
star
2

react-native-es6-reflux

Boilerplate for iOS app development with React Native, ES6 and Reflux
Objective-C
141
star
3

write-good-git

Write more good git commit messages
JavaScript
81
star
4

nod

Notifications in PHP (notify-send, growl, etc) like that.
PHP
52
star
5

oversmash

Overwatch API library for player details and career stats
TypeScript
45
star
6

why

webkit in the cloud
JavaScript
31
star
7

Markdown

A cleaned-up and improved version of Michel Fortin's Markdown_Parser
PHP
18
star
8

homeassistant-ws

Minimalist client library for Homeassistant's Websocket API
TypeScript
12
star
9

beacon-ui

A pretty sweet UI theme for the Atom editor
CSS
11
star
10

next-better-api

Opinionated TypeScript-first helpers for better NextJS APIs
TypeScript
10
star
11

dirp

php5 directory indexing interface and framework
PHP
10
star
12

oversmash-api

GraphQL API for Overwatch player information and stats
JavaScript
7
star
13

wayne

Laravel4 Debug Toolbar
PHP
6
star
14

Spy

Spy is a simple, flexible and easy to extend dependency injection container.
PHP
5
star
15

survhey

Surveys in 30 seconds
Ruby
4
star
16

ts-es6-boilerplate

Minimalistic boilerplate for TypeScript projects targeting ES6 (with Babel).
JavaScript
4
star
17

silex-chisel

An opinionated silex project accelerator
PHP
3
star
18

comfy

Configure your applications comfortably
JavaScript
3
star
19

miniscurl

Miniscurl - URL shortener/expander for Google Chromeβ„’.
JavaScript
3
star
20

roast

lightweight php5.3 api framework
PHP
2
star
21

inventory

An inventory system for the rest of us
TypeScript
2
star
22

gimme

Inject your services with *magic*
PHP
2
star
23

turnip

A small php-5.3 framework cleverly disguised as a turnip.
PHP
2
star
24

aws-eb-config-switcher

Manage multiple elasticbeanstalk configurations for the same project
Shell
1
star
25

oversmash.com

Overwatch Workshop repository
Ruby
1
star
26

e2u

E2 Userland Library
1
star
27

place

Custom-tailored home automation platform
JavaScript
1
star
28

slash-blade

A simple routing library for the slash language.
1
star
29

tooty

Simple agnostic message router for node.
JavaScript
1
star
30

whatdo

Ruby
1
star
31

Justin.tv-Notifier

JavaScript
1
star
32

didya

Suggestions for misspelled symbols in PHP (functions, variables, ...) injected directly in the Exception
PHP
1
star
33

thebigdb-php

TheBigDB PHP bindings.
PHP
1
star
34

jotform

Ruby wrapper for the JotForm API
Ruby
1
star
35

stormworks-screen-api

Canvas-based JS/Typescript implementation of the Stormworks LUA screen API.
TypeScript
1
star