phphd/exception-handler
PHPhD Exception Handler offers a structured way to manage exceptions in Laravel/PHP applications, with configurable handling and cleaner error responses for more predictable debugging and user-facing failures.
try/catch scattered through controllers and services, instanceof chains in a hand-rolled handler, ad-hoc status code maps. This package is a candidate to replace that bespoke code with a maintained convention. The PM question is straightforward: is how we render and report failures a differentiator, or is it undifferentiated plumbing we should stop funding? For most teams it is the latter.^1.1.Decision this package does not settle: it is not an observability or alerting product. If the actual pain is "we don't know when things break," the answer is Sentry/Bugsnag/Flare plus Laravel's native handler, not this package.
Adopt when:
Look elsewhere or defer when:
withExceptions() already covers you. It often does. Adopting a package here buys convenience, not capability — establish the delta first. Mixing both mechanisms makes precedence non-obvious; pick one owner per exception.Recommended gate before committing: read the actual 1.1.0→1.1.1 diff, reconcile the Symfony Messenger framing against the Laravel integration described in the docs, confirm the supported version matrix against your fleet, and run a one-service spike on your noisiest instanceof chain.
For executives: This is a small consolidation play, not a platform bet. It replaces hand-rolled error handling with a maintained convention, which makes what customers see when something fails more consistent and shortens the time support and on-call spend diagnosing incidents. Cost is one dependency — pinned, swappable, and contained behind an adapter. The honest caveat: the project is early-stage, effectively single-maintainer, and its latest release notes are a link to a diff. So the recommendation is evaluate in one non-critical service for a week, not standardize across the fleet. If the spike is clean, we get the consistency benefit at near-zero cost; if it isn't, we've spent a week and learned something about a class of dependency we will keep encountering.
For engineering: Adopt it to delete boilerplate — exception-to-response mapping, a consistent error envelope, and reporting context centralized instead of repeated across controllers and jobs. Error paths become testable, and handler precedence becomes an explicit, reviewable list rather than emergent behavior. Two conditions on adoption: (1) wrap it in a thin internal adapter so the dependency is swappable and our error contract remains ours, not the package's; (2) treat it as critical-path code — code review, pinned ^1.1, and a documented rollback. Practical notes for the spike: watch for double registration if you also use withExceptions(), config:clear after any registry change (the most common "my handler doesn't run" cause), guard HTTP-shaped responses against console and queue contexts, and never let getMessage() or traces reach a production client. 1.1.1 is a patch with no breaking changes, safe within the 1.x line — but read the diff first, and confirm whether the "Symfony Messenger" framing in the package description implies a transport or async concern the Laravel docs don't mention.
How can I help you explore Laravel packages today?