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
Symfony Http Exceptions Bundle

Symfony Http Exceptions Bundle Laravel Package

halloverden/symfony-http-exceptions-bundle

A Symfony bundle that provides HTTP-aware exception classes for your applications. Throw typed exceptions that map to status codes and render consistent error responses while keeping controllers and services clean. Integrates with Symfony's exception handling.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Symfony Http Exceptions Bundle
Can I use halloverden/symfony-http-exceptions-bundle in a Laravel application?
Not as a bundle. Laravel does not register Symfony Bundle subclasses or boot a Symfony Kernel, so the bundle class, its DI extension and compiler pass have nowhere to run. Only the underlying halloverden/symfony-http-exceptions exception classes are portable, and those are the part worth evaluating.
How do I install the HTTP exception classes for use in Laravel?
Require the core package rather than the bundle with composer require halloverden/symfony-http-exceptions. Run a composer require --dry-run first against your target Laravel version and inspect the resolved symfony/* tree for downgrades or constraint clashes. Then map the exception types to responses in App\Exceptions\Handler or through a Renderable implementation.
Is this package compatible with Laravel 10 and Laravel 11?
The bundle itself is never loaded by Laravel, so compatibility only concerns the exception classes. Laravel 10 and 11 pin symfony/http-foundation and symfony/http-kernel to specific majors, and the package's declared Symfony constraints are not visible in the available metadata. Always verify with a dry-run Composer resolve before committing.
What do these exceptions offer over Laravel's abort() helper and Symfony HttpException?
Functionally they are the same primitive: a status code, optional headers and a message. The only plausible advantage is a typed exception vocabulary, for example one class per HTTP error, which can make raise sites more expressive and easier to test. Nothing in the metadata evidences a differentiator such as RFC 7807 problem+json payloads, so treat the added value as unproven until you spike it.
How do I render these exceptions as JSON error responses in Laravel?
Catch them in App\Exceptions\Handler, either in the renderable callback or with a match on exception class, and return response()->json($e->getMessage(), $e->getStatusCode(), $e->getHeaders()). Alternatively implement Illuminate\Contracts\Support\Renderable on a small adapter so the exceptions render themselves without touching the handler. Keep the adapter minimal and backfill call sites one bounded context at a time.
Do I need to register the Symfony bundle or its DI extension in Laravel?
No, and you should not try. Laravel's container bootstraps through ServiceProviders rather than Symfony's Kernel, so bundles, extensions and compiler passes have no execution point. Any integration plan that begins with registering the bundle is a non-starter; consume the exception classes directly instead.
Is halloverden/symfony-http-exceptions-bundle actively maintained and safe for production?
The available signals are weak: a single low-visibility maintainer, zero stars, zero dependents and no security advisory history to rely on. Exception-handling paths are a sensitive surface, so an unvetted package with write access there deserves caution. If you adopt it, vendor-lock the version and consider a fork or a composer replace entry to protect against abandonment.
What are the alternatives to this package for HTTP exceptions in Laravel?
Laravel already ships abort($code, $message, $headers) plus Symfony\Component\HttpKernel\Exception\HttpException through its existing http-foundation and http-kernel dependencies. You can also write a small custom exception hierarchy or use a problem-details package if you need RFC 7807 payloads. For most applications the native primitives cover the same surface with no added dependency.
How should I test that these exceptions produce the right status codes and headers?
Unit test the exception classes directly for getStatusCode(), getHeaders() and the message, since that is the only behaviour they add. Then add feature tests that hit routes and assert with assertStatus(), assertHeader() and assertJson() against your handler adapter. If the classes prove to be pure PHP with no Symfony runtime dependencies, the unit tests need no framework boot at all.
What is the migration path if this package is abandoned?
Because only the exception value objects are portable, the exit cost is low. Require the core package rather than the bundle, wrap it behind a thin adapter in your exception handler, and keep abort() for everything else. If that adapter turns out to be under roughly 50 lines, you have gained little over native abort() and should revert rather than carry the dependency.
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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections