Symfony JsonRequest Bundle

4.0.6 2021-09-13 13:23 UTC

This package is auto-updated.

Last update: 2021-09-13 13:26:53 UTC


Scrutinizer Code Quality Code Coverage Total Downloads Latest Stable Version License


  • Require the bundle with composer:
composer req symfony-bundles/json-request-bundle

What is JsonRequest Bundle?

This bundle will help you to work with json requests as standard requests without using «crutches». If previously for fetching of data from the request you did like this: $data = json_decode($request->getContent()), it is now in this already there is no need to.

For example when sending json-request from AngularJS, Vue.js or etc. Early:

public function indexAction(Request $request)
    $data = json_decode($request->getContent(), true);

    // uses request data
    $name = isset($data['name']) ? $data['name'] : null;

Now you can work with json-request as with standard request:

public function indexAction(Request $request)
    $name = $request->get('name');