- Does flying-narwhal/json-request-bundle work with Laravel?
- No. This is a Symfony bundle, not a Laravel package. It relies on Symfony bundle registration, a DI extension, and a kernel.request event listener, none of which Laravel supports. Composer may install it, but it will never bootstrap in a Laravel application. Use Laravel's native JSON request handling instead.
- How do I install flying-narwhal/json-request-bundle in a Laravel application?
- There is no supported install path for Laravel. A composer require would produce an inert dependency because Laravel has no bundle discovery layer or equivalent registration mechanism for Symfony bundles. Do not add it to a Laravel project. Use $request->json(), $request->input(), and FormRequest validation instead.
- What does flying-narwhal/json-request-bundle actually do?
- It is a Symfony bundle that decodes JSON request bodies and writes them into Symfony's request parameter bag so controllers can read fields through $request->request. It ships a Bundle subclass, a DI extension, and a kernel.request event listener. That behavior was historically useful for Symfony Form and Validator components. Laravel already provides equivalent JSON input handling without a bundle.
- Is there a Laravel equivalent to flying-narwhal/json-request-bundle?
- Yes, Laravel has this behavior natively. Illuminate\Http\Request transparently merges JSON payloads into input() and all(), exposes $request->json(), and lets FormRequest validation read JSON fields without custom parsing. You do not need a bundle or middleware for standard JSON request handling. For Symfony hosts, compare against Request::toArray() and the first-party serializer path before adding a third-party bundle.
- How do I read a JSON request body in Laravel without extra packages?
- Use $request->json() for a JSON payload, or $request->input('field') and $request->all(), which include JSON data. Type-hint Illuminate\Http\Request in your controller and validate with a FormRequest. No third-party package is required for normal JSON request handling.
- Does this package support Laravel 10 or Laravel 11?
- It does not declare Laravel version support because it is a Symfony bundle. Laravel 10 and 11 already handle JSON requests natively through $request->json(), input(), and FormRequest validation. Do not expect a service provider or a Laravel integration path.
- Which Symfony and PHP versions does flying-narwhal/json-request-bundle support?
- The available context does not declare supported Symfony or PHP version ranges. Symfony bundle conventions and the event dispatcher have changed across Symfony 4, 5, 6, and 7, so an out-of-date bundle could pin transitive packages and conflict with the host application. Audit composer.json constraints and security patch status before considering it for a Symfony host.
- What happens if the JSON body is malformed with this bundle?
- The context flags this as an audit question. If the listener swallows json_decode failures and leaves the parameter bag empty, downstream validation sees missing fields rather than a parse error. That can produce a confusing 422 response instead of a clear 400. Verify the listener's behavior on malformed JSON, empty bodies, and mismatched Content-Type before relying on it.
- Is flying-narwhal/json-request-bundle safe for production?
- The package has 6 stars, 0 dependents, a composite score of 0.27, and a single maintainer with no evidence of a security policy. Zero dependents is a strong signal that it has not been exercised in production dependency graphs. For Laravel it adds attack surface for no functional gain. For Symfony, audit it against first-party options and confirm listener ordering and merge precedence.
- Should I write a custom Laravel middleware instead of using this bundle?
- For Laravel, yes, if you genuinely need to normalize a legacy JSON contract. A small ConvertJsonRequest middleware of roughly 60 lines can check isJson(), merge decoded fields with $request->merge(), and return an explicit 400 on decode failure. That keeps behavior under test and avoids an unmaintained Symfony bundle. Standard Laravel JSON handling needs no middleware at all.