Developed with love by KnpLabs Hire us for your project!
68

json-request-bundle

by symfony-bundles

Symfony Json Request Bundle

SymfonyBundlesJsonRequestBundle

SensioLabsInsight

Build Status
Scrutinizer Code Quality
Code Coverage
Total Downloads
Latest Stable Version
License

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 or etc.
Early:
``` php
public function indexAction(Request $request)
{
$data = json_decode($request->getContent());

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

}
```

Now you can work with json-request as with standard request:
php
public function indexAction(Request $request)
{
$name = $request->get('name');
}

Installation

  • Require the bundle with composer:
composer require symfony-bundles/json-request-bundle
  • Enable the bundle in the kernel:
public function registerBundles()
{
    $bundles = [
        // ...
        new SymfonyBundles\JsonRequestBundle\SymfonyBundlesJsonRequestBundle(),
        // ...
    ];
    ...
}
The MIT License (MIT)

Copyright (c) 2016-2017 Symfony Bundles (Dmitry Khaperets)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
maker:
listener:
request_transformer: SymfonyBundles\JsonRequestBundle\EventListener\RequestTransformerListener
priority: 100
  • Merge pull request #8 from samgreenwood/change-listner-priority
    By web-flow, 4 months ago
  • Make listener priority configurable.
    By Sam Greenwood, 4 months ago
  • Merge pull request #9 from kblais/fix-treebuilder-deprecation-notice
    By web-flow, 4 months ago
  • Also run Travis tests with Symfony 4.2
    By Killian Blais, 4 months ago
  • Add a compatibility layer for symfony/config < 4.2
    By Killian Blais, 4 months ago
  • Fix the deprecation notice on the TreeBuilder added in Symfony 4.2
    By Killian Blais, 4 months ago
  • [Core] Updated composer.json
    By khaperets, 1 year ago
  • Merge pull request #7 from symfony-bundles/dev
    By web-flow, 1 year ago
  • [Core] Typo fix in composer.json
    By khaperets, 1 year ago
  • [Core] Updated Travis Configuration
    By khaperets, 1 year ago
  • [Core] Upgraded to PHP 7
    By khaperets, 1 year ago
  • [Core] Upgraded to PHP 7
    By khaperets, 1 year ago
  • Merge pull request #6 from symfony-bundles/1.2
    By web-flow, 1 year ago
  • [Tests] Updated Travis CI configuration
    By khaperets, 1 year ago
  • [Tests] Added PHP 7.2 and hhvm to Travis CI configuration
    By khaperets, 1 year ago
  • Merge pull request #5 from symfony-bundles/1.2
    By web-flow, 1 year ago
  • [Tests] Updated Travis CI configuration
    By khaperets, 1 year ago
  • [Refactoring] Tested PHPUnit versions
    By khaperets, 1 year ago
  • [Refactoring] Tested PHPUnit versions
    By khaperets, 1 year ago
  • [Tests] Checking PHPUnit versions for tests
    By khaperets, 1 year ago
  • [Refactoring] Updated Code Style
    By khaperets, 1 year ago
  • Merge pull request #4 from BlueM/master
    By web-flow, 2 years ago
  • Update RequestTransformerListenerTest.php
    By web-flow, 2 years ago
  • Update RequestTransformerListener.php
    By web-flow, 2 years ago
  • Make sure that decoded value is an array
    By , 2 years ago
  • Update README.md
    By web-flow, 2 years ago
  • Update README.md
    By web-flow, 2 years ago
  • Merge pull request #3 from symfony-bundles/dev
    By web-flow, 2 years ago
  • [Docs] Updated README.md
    By khaperets, 2 years ago
  • [Tests] Fixed PHPUnit version
    By khaperets, 2 years ago