- Does mattjanssen/api-response-bundle work with Laravel?
- No. It is a Symfony bundle for standardizing JSON success and error envelopes, and its core mechanism depends on Symfony's kernel.view and kernel.exception events, which Laravel never dispatches. There is no service provider, facade, or middleware bridge in the package. Laravel developers would have to write all of the integration glue themselves, so it is effectively unusable as-is.
- What PHP versions does mattjanssen/api-response-bundle support?
- The Composer constraint is php ^5.4|^7, so PHP 8.0 and later are not declared as supported. Every Laravel release still in security support (9, 10 and 11) requires PHP 8.0 or newer. That mismatch alone blocks adoption in any modern Laravel application. The Symfony 5 line it targets effectively means PHP 7.4, which is end of life.
- Why does Composer fail when I require this bundle in a Laravel app?
- The bundle requires the symfony/symfony meta-package, which pins the entire Symfony stack to a single version instead of individual components. Laravel pins components such as symfony/http-kernel to 6.x or 7.x, so the two requirement sets cannot be satisfied simultaneously. Combined with the PHP ^5.4|^7 constraint, dependency resolution fails before any code is loaded.
- How does the bundle hook into the framework to build responses?
- It listens on Symfony's kernel.view and kernel.exception events and converts controller return values and thrown exceptions into a consistent JSON envelope. That event-driven design is the whole mechanism. Laravel's request lifecycle exposes no equivalent events, so none of the behavior carries over. Porting it means rewriting the transformation layer, not configuring it.
- What should Laravel developers use instead for consistent JSON responses?
- Laravel already ships the pieces: Responsable response objects, API Resources for transformation and pagination, renderable() callbacks on the exception Handler for error shapes, and middleware for enforcing structure. A small base controller or a dedicated response factory covers the envelope part in a few dozen lines. All of it stays inside Laravel's own contracts and none of it requires a Symfony event listener.
- Is mattjanssen/api-response-bundle still maintained and safe for production?
- The v1.0.0 release changed dependency metadata only, with no source files, listener changes, or API changes, which suggests constraints were widened without demonstrated testing. The package also shows zero dependents on Packagist, always a useful signal about real-world adoption. It additionally pulls in sensio/framework-extra-bundle, which is deprecated upstream. Risk is high and the maintenance outlook is unclear.
- Did version 1.0.0 make the bundle compatible with Laravel?
- No. The 1.0.0 diff is Composer metadata only: constraints were widened to accept symfony/symfony ^5 and sensio/framework-extra-bundle ^5. The blocking layer, the kernel.view and kernel.exception listeners, is untouched. The release changes what Composer can resolve, not what the code does. PHP 8 support is still undeclared.
- What does the response envelope actually give you?
- It standardizes success and error payloads so controllers return a predictable structure across endpoints, with helpers for common HTTP status codes and messages. It also supports pagination metadata for list endpoints and configurable response formatting. On Symfony that is a reasonable convenience if you want uniform JSON without repeating array shapes in every controller. The value does not transfer to Laravel.
- Can I use the bundle on PHP 7.4 with Laravel 8?
- A narrow window exists where Laravel 8 on PHP 7.4 with Symfony 5.4 components might resolve. It still would not work, because Laravel does not dispatch kernel.view, so the response transformation never runs. Laravel 8 and PHP 7.4 are both out of security support. That window is not viable and should not be mistaken for compatibility during a package review.
- Should we fork the bundle and adapt it for Laravel?
- Forking means replacing the event listeners with a service provider, middleware, Responsable support, and an exception Handler integration, which is essentially a rewrite. You would inherit the PHP ceiling, the deprecated framework-extra-bundle dependency, and the serializer surface as ongoing liabilities. Reimplementing the envelope natively is less work and far easier to test. Fork only if you must preserve an identical payload contract across a mixed Symfony and Laravel estate.