explaingit

filp/whoops

13,236PHPAudience · developerComplexity · 2/5Setup · easy

TLDR

A PHP error handling library that replaces the default confusing crash screen with a clear, well-designed error page showing exactly what went wrong and where in your code.

Mindmap

mindmap
  root((repo))
    What It Does
      Better PHP error pages
      Stacked error handling
      Editor file links
    Built-in Handlers
      Pretty page
      Plain text CLI
      JSON response
      XML response
    Integration
      Composer install
      Laravel built-in
      Other frameworks
    Audience
      PHP developers
      Web app builders
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add a polished error page to any PHP project so you can diagnose bugs faster during development.

USE CASE 2

Click a file path in the error page to jump directly to that line in your code editor.

USE CASE 3

Return error details as JSON for API endpoints so front-end clients receive structured error information.

Tech stack

PHPComposer

Getting it running

Difficulty · easy Time to first run · 5min

Install via Composer, already bundled in Laravel, no extra setup needed for Laravel projects.

No license is specified in the README.

In plain English

whoops is a library for PHP, a programming language used to build websites and web applications, that improves how errors are shown when something goes wrong in your code. Its tagline calls it PHP errors for cool kids. Out of the box, when your program crashes, whoops replaces the usual confusing error message with a clear, well-designed error page that helps a developer see what happened and where. Underneath the friendly error page, the README describes it as a stacked error handling system. In plain terms, you can register one or more handlers that each get a chance to deal with an error, and you can arrange them in order. The library has no required outside dependencies and offers a simple way to inspect an exception and the chain of function calls that led to it. One handy feature noted in the README is the ability to click a referenced file in the error page and open it directly in your code editor. whoops ships with several built-in handlers for different situations. The PrettyPageHandler produces the polished error page, the PlainTextHandler is meant for command-line programs, and the JsonResponseHandler and XmlResponseHandler return error details in formats that work well with background web requests. A callback handler lets you plug in your own custom logic. Installation is straightforward. The README notes that several popular PHP frameworks, including recent versions of Laravel, already include whoops, and it lists community guides for many others. If you are not using one of those, you can add it with Composer, the standard PHP package manager, and register the pretty handler in a few lines of code. The README also shows how to capture the generated error HTML yourself instead of displaying it directly. The library was created by Filipe Dobreira and is currently maintained by Denis Sokolov, with help from many contributors.

Copy-paste prompts

Prompt 1
I'm adding filp/whoops to a plain PHP project without Laravel. Show me the exact setup code to register the PrettyPageHandler.
Prompt 2
Using whoops, how do I add a custom handler that logs errors to a file before showing the pretty error page?
Prompt 3
My whoops error page shows file paths I want to open in VS Code. How do I configure the editor link?
Prompt 4
Help me set up whoops to show the pretty error page in development but return a JSON error response in production.
Open on GitHub → Explain another repo

← filp on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.