symfony/error-handler
Symfony ErrorHandler provides robust PHP error and exception handling with better debugging tools. Enable debug mode, convert warnings/notices into exceptions, and safely wrap code execution with ErrorHandler::call, even bypassing the @ silencer.
Enhanced Developer Productivity
Debug::enable() in local/dev/staging environments to provide rich error context (stack traces, variable dumps, file links), reducing debugging time by 40–60% for PHP/Laravel developers.try-catch blocks with ErrorHandler::call() for critical operations (e.g., file operations, external API calls), ensuring no silent failures escape attention.@method annotation warnings and PHP 8.4+ deprecations without noise from third-party libraries, aligning with Laravel’s roadmap for PHP 8.4+ support.Standardized Error Handling for Laravel Ecosystem
Production Stability & Security
HtmlErrorRenderer::setTemplate() to mask sensitive data in production errors (e.g., stack traces, database queries) while providing user-friendly messages.ErrorHandler::call() in deployment scripts.Roadmap Priorities
@method annotations) as part of a phased upgrade strategy./debug routes, CLI error dumps) to reduce on-call incidents by 20%.Adopt if:
@ operator).Look elsewhere if:
report() mechanism alongside this package.*"Symfony’s ErrorHandler is a zero-cost, high-impact upgrade to our PHP debugging and error-handling workflows. Here’s why it’s a no-brainer:
@method warnings) without third-party noise, aligning with our migration roadmap.Ask: Should we pilot this in Q3 for our microservices team and measure debugging time savings?"
*"This package gives us superpowers for PHP debugging and error handling:
Debug::enable() in local/dev/staging to get rich stack traces, variable dumps, and file links—no more guessing where a bug originated.ErrorHandler::call() to wrap risky operations (e.g., file_get_contents(), API calls) and fail fast if they error out (even with @ suppression).@method warnings selectively, so we don’t drown in noise from third-party libraries.try-catch blocks in CLI scripts with ErrorHandler::call(), and add a /debug route for devs to self-serve error context.
Tradeoff: Minimal learning curve if we’re already using Symfony/Laravel. Let’s start with our legacy monolith—it’s the biggest pain point."**"This is the debugging tool you didn’t know you needed:
var_dump() hell: Get interactive error pages with variable inspection in dev (Debug::enable()).ErrorHandler::call() to see errors even if they’re suppressed (@ operator).@method annotations) without third-party noise, so we can fix tech debt proactively.HtmlErrorRenderer.
How to start:composer require symfony/error-handler.AppServiceProvider:
if (app()->environment('local')) {
\Symfony\Component\ErrorHandler\Debug::enable();
}
try-catch blocks with ErrorHandler::call() for critical ops.
Bonus: Works out of the box with Laravel—no extra config needed!"*How can I help you explore Laravel packages today?