Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Exceptions Laravel Package

graham-campbell/exceptions

Graham Campbell's Exceptions package gives Laravel apps a cleaner, more powerful exception handling setup, with custom handlers, reporting, throttling, and rendering so errors are easier to manage and debug.

View on GitHub
Deep Wiki
Context7

Provides A Powerful Error Response System For Both Development And Production

Frequently asked questions about Exceptions
What is graham-campbell/exceptions used for in Laravel?
It provides a drop-in exception handler for Laravel applications. It centralizes error handling and renders consistent HTML and JSON responses based on the request's Accept header, with customizable error views, formatting, logging, and reporting. Use it when you want declarative exception-to-response mapping instead of scattered try/catch blocks and render() overrides.
How do I install graham-campbell/exceptions?
Install it with Composer using composer require graham-campbell/exceptions. Then publish its configuration and bind the package handler in your Laravel application as described by the package docs. The mechanical setup is low effort, but you should still validate behavior with a small route and API path before rolling it out.
Which Laravel and PHP versions does graham-campbell/exceptions support?
For explicit Laravel 11 and PHP 8.4 support, use ^17.2 of the package. The intended stack is Laravel 10–11 on PHP 8.2–8.4. Check the released version constraints before upgrading Laravel or PHP, because major Laravel releases can change the exception-handling integration surface.
Does it replace Laravel's default exception handler or Laravel 11 withExceptions?
It is designed as a drop-in replacement for Laravel's default exception handler, not merely a wrapper. On Laravel 11 you need to confirm how it interacts with the native bootstrap/app.php withExceptions() configuration and which surface wins when both are configured. Treat that as an explicit compatibility check in your spike.
How does graham-campbell/exceptions handle HTML and JSON error responses?
It content-negotiates responses using the request's Accept header, returning HTML for browsers and JSON for API clients with sensible defaults. You can customize error views and response formatting so the payload matches your public API contract. Verify status codes, stable error codes, correlation IDs, and client-safe messages with golden-file tests.
Can I customize error views and JSON error formatting?
Yes. The package supports customizable error views and response formatting, and it uses native Laravel configuration and integration. The main work is defining and owning your error taxonomy and response envelope, not wiring the package. Keep v1 focused on reporting and rendering parity before adding new custom handlers.
Does graham-campbell/exceptions support logging, reporting, and throttling?
The package supports configurable logging, per-exception log levels, reporting, and throttling as part of centralized exception handling. Confirm how it integrates with your existing Sentry, Bugsnag, or OpenTelemetry reporting so you do not create duplicate reports or a reporting gap. Also check queue and failed_jobs reporting paths.
Is graham-campbell/exceptions safe to use in production?
It sits on the global error path, so treat it as Tier-0 infrastructure rather than a feature library. The dominant risk is dependency governance: weak adoption signals, a single-maintainer surface, and possible incompatibility with future Laravel majors. Gate adoption on a short spike, documented error taxonomy, behavior tests, and a written exit or fork plan.
What happens if the exception handler itself throws an error?
That is a key production concern to test rather than assume. You need to confirm whether the package degrades to Laravel's default renderer or produces a blank 500 when its own handler fails. Also verify that renderers are side-effect free and do not perform database, cache, or outbound HTTP calls during an outage.
How should I test a migration to graham-campbell/exceptions?
Treat it as an error-contract migration: inventory current render() overrides, abort codes, validation, 404, 429, auth responses, API envelopes, and reporting paths. Codify exception class, status code, body shape, and log/report behavior as golden-file tests before installing. Install on a branch, bind the handler, run the tests, and ship behind a config flag with Laravel's native handler as fallback.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console