flying-narwhal/json-request-bundle
Symfony bundle that decodes JSON request bodies into Symfony's request parameter bag, letting controllers read JSON payloads through the usual $request->request API without custom parsing.
$request->request parameter bag from application/json bodies, or do we write and own that logic ourselves? Given the package's profile (6 stars, 0 dependents, score 0.27, opportunity 16.79), the realistic answer is "borrow the pattern, own the code" — vendor or reimplement rather than take a runtime dependency.bundles.php and depend on the Symfony HTTP kernel event system; Laravel has no equivalent registration path. If the motivating need is "Laravel-like JSON handling in our Symfony app," this is on-target. If the team is actually on Laravel, the decision is a non-starter — Laravel's Request already resolves JSON input via input()/json(), so there is nothing to buy.json_decode($request->getContent(), true) and instead read from a single, predictable place. That is a maintainability and onboarding decision, not a feature decision — it pays off in proportion to how many endpoints currently duplicate that boilerplate.#[MapRequestPayload] / a serializer-based approach and avoid a throwaway step.$request->request->get('foo') to "just work" for JSON. It reduces cognitive translation cost during a migration window.Consider it when all of the following hold:
composer.json — do not assume.$request->request->get(...), so a global body-parsing listener delivers immediate, broad cleanup rather than solving one endpoint.json_decode depth limits, request body size limits, behavior on malformed JSON (does it 400 cleanly or leak a PHP warning?), and whether it mutates the request in ways other middleware doesn't expect.Look elsewhere when:
#[MapRequestPayload] (and #[MapQueryString]) with the Serializer gives typed, validated request objects with no third-party dependency. That is a stronger default and a better long-term story.For executives: This is a small, MIT-licensed utility that removes duplicated JSON-parsing code from Symfony controllers. It is not a strategic investment and carries no license cost. The material risk is maintenance: with 6 stars and zero dependent projects, there is effectively no upstream support, so I would only approve it as code we copy in and own — a few days of engineering, not a vendor relationship. If we are on Laravel, it does not apply at all.
For engineering: One listener that decodes application/json bodies into the request parameter bag so controllers read $request->request->get() uniformly. Before adopting: verify Symfony version compatibility in composer.json, read the full source (it is small), confirm the malformed-JSON path returns a 400 rather than a warning, and check body-size and decode-depth handling. Recommendation is to vendor or reimplement rather than add it as a Composer dependency — the logic is small enough to own outright, and that removes the abandonment risk entirely. Treat it as a bridge: the durable target is #[MapRequestPayload] with typed DTOs on Symfony 6.3+, and we should schedule that rather than let the bridge become the architecture.
How can I help you explore Laravel packages today?