
whoops
A PHP error handler that shows readable, debuggable error pages instead of raw crashes.
- Stars
- 13.2k
- Forks
- 599
- Licence
- MIT
- Language
- PHP
- Last update
- 4 days ago
- Type
- Library
What it is
Whoops is a PHP library that catches errors and exceptions and reports them in a more useful way. Out of the box it can show a detailed error page in the browser to help debug a web project, and it can also return plain text, JSON, or XML for command-line tools and AJAX requests. It is built as a stack of handlers, so you can choose or combine how errors are shown.
- Show a detailed, readable error page while developing a PHP website
- Return error details as JSON so a front-end AJAX call can display them
- Print plain text error messages from a PHP command-line application
- Open files referenced in a stack trace directly in your editor or IDE, per the README's linked docs
Great for
- PHP developers debugging web applications locally
- Teams using Laravel, Mezzio, or another framework listed in the README that already bundles it
- Developers who want JSON or XML error output for AJAX or API-style requests
- Developers building custom error reporting who want a stackable handler system
Not ideal for
- Production sites where detailed error pages could expose sensitive internals; the README describes a debugging-focused error page and does not address production use
- Non-PHP projects, since this is specifically a PHP library
- Projects that need a full logging or monitoring service; the README does not describe one
How to get it
- 1
Install with a package manager
You'll need: PHP · Composer
Install with Composer
composer require filp/whoops - 2
Run it
- Install the package with Composer using the command above.
- Create a Whoops\Run instance in your code.
- Push the PrettyPageHandler onto the stack with pushHandler.
- Call register() so Whoops catches errors and exceptions.
- Trigger an error in your project to see the error page.
- 3
Get the most out of it
- Use the editor integration described in the docs to open referenced files directly in your IDE.
- Add JsonResponseHandler or XmlResponseHandler for AJAX or API requests.
- Use handleException with writeToOutput(false) to capture the generated HTML for your own processing.
- Extend Whoops\Util\SystemFacade to override system calls, as the README describes.
- Check the examples/ folder and API documentation for more options.
Downloads
Strengths
- Simple setup: install with Composer and register one handler
- Multiple built-in handlers for HTML, plain text, JSON, and XML output
- Stand-alone with no required dependencies, according to the README
Trade-offs
- The default error page is meant for debugging, so it needs to be configured or disabled for production
- The README is truncated and does not give detailed production configuration guidance
- Latest release information is not listed, so version stability is harder to judge from the metadata
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| whoops (this) | 13.2k | Library | beginner | 4 days ago | PHP developers debugging web applications locally |
| Sortable | 31.2k | Library | beginner | 8 months ago | Web developers adding reorderable lists to a site or app |
| parsedown | 15k | Library | beginner | 9 months ago | PHP developers who need to render Markdown inside a PHP web application |
| auto-animate | 14k | Library | beginner | 4 months ago | Frontend developers who want polished list or menu transitions without writing animation code |
| pest | 11.8k | Library | intermediate | 4 days ago | PHP developers who want to add automated tests to a project |
| reactstrap | 10.5k | Library | beginner | 2.1 years ago | React developers who already know Bootstrap and want its styling as components |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.