filp/whoops
Pretty error handler for PHP that turns fatal errors and exceptions into clean, developer-friendly pages with stack traces, request context, and code previews. Great for local development, debugging, and integrating into frameworks to replace default error screens.
Install via Composer: composer require filp/whoops --dev. Enable in development by swapping PHP's default error handler—typically in public/index.php or a dev-only middleware—using Whoops\Run::pushHandler(new Whoops\Handler\PrettyPageHandler()). The handler renders a beautiful, interactive error page with stack traces, variable inspection, and code preview. Start by adding it to your request lifecycle’s early bootstrap phase—ideally before any output is sent.
Whoops service provider (via laravel/framework >= 5.4). It’s automatically enabled in local environment. Customize via config/app.php’s debug flag or config/whoops.php.PrettyPageHandler for local dev, JsonResponseHandler for APIs, and PlainTextHandler for CLI.Whoops\Handler\Handler to add email alerts, log correlation IDs, or UI tweaks (e.g., setEditor('phpstorm') for one-click file opening).env('APP_ENV') === 'local') to avoid accidental exposure in production.echo before initialization. Use output buffering or early handler setup.PrettyPageHandler::setFramesSkipped() to hide internal framework boilerplate from stack traces, keeping focus on your code.PlainTextHandler or dedicated error logging services instead.$handler->setEditor('vscode|phpstorm|sublime') and paths (e.g., setRootPath('/app'), setUrlCallback(fn($file, $line) => "vscode://file/$file:$line")) for "Open in IDE" links.xdebug.show_exception_trace=0 and xdebug.collect_vars=1 for full detail—Xdebug sometimes manglesWhoops’ frame info.How can I help you explore Laravel packages today?