samson/unexpected-response-bundle
A Symfony bundle for handling unexpected HTTP responses, helping applications detect, catch, and present responses that fall outside normal expectations with a structured, consistent approach.
Response, catch it in a listener, and render it — lets a domain/service class return a redirect, 402, 423, or error page without threading Response objects through every controller and method signature. That is a genuine architectural convenience for guard clauses, maintenance-mode gates, entitlement checks, and API error envelopes emitted from deep service layers.Illuminate\Http\Exceptions\HttpResponseException and the abort() helper. The correct product decision is “adopt the pattern, reject the dependency.”Consider the pattern when:
Look elsewhere when:
HttpResponseException / abort() / render() on exceptions. Adding a 2014 Symfony bundle to a Laravel app is a net-negative: dead code, conflicting service providers, and an unsupported PHP constraint.Red flags to log: unmaintained since 2014; effectively a one-person artifact; no ecosystem validation; exceptions-as-control-flow will pollute error logs and can interfere with transaction/rollback boundaries unless the listener is ordered carefully.
To executives (one paragraph): Engineering evaluated a small open-source package that lets code return an HTTP response from anywhere by throwing an exception. The pattern is useful, but the package itself is abandonware — last updated in 2014, one star, no users, and it targets an older framework generation. Critically, Laravel already provides this capability natively. Recommendation: do not add the dependency; adopt the pattern in-house at near-zero cost. Net effect is capability gained, supply-chain risk avoided, and no new vendor or licensing overhead.
To engineering leadership: This is a design pattern, not a product. The value is in the convention — one exception type carrying a Response, one listener, one place where exceptions become HTTP. On Laravel, use HttpResponseException; on Symfony, use HttpException plus a kernel exception listener. Budget roughly half a day to standardize the convention, document when it is allowed (guard clauses and terminal states only, never for expected business branching), and enforce listener priority so it runs before generic error handlers. Treat vendor adoption as out of scope; the only exception is a legacy Symfony 2 app already on it, which should be pinned and scheduled for removal.
To the delivery team: Adopt the pattern behind a thin internal wrapper so the framework detail stays swappable. Add a lint/review rule that response-throwing exceptions are only raised at terminal decision points — otherwise stack traces and logs become misleading and on-call debugging gets harder.
How can I help you explore Laravel packages today?