Download the PHP package bu/json-response-bundle without Composer
On this page you can find all versions of the php package bu/json-response-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bu/json-response-bundle
More information about bu/json-response-bundle
Files in bu/json-response-bundle
Package json-response-bundle
Short Description Symfony2 bundle allows to use templates for json responses
License MIT
Homepage http://github.com/Fludimir/JsonResponseBundle
Informations about the package json-response-bundle
BuJsonResponseBundle
BuJsonResponseBundle helps you to use templates for json responses in just same way as templates are used for html responses, allowing you to separate business logic and data presentation when you need to return data in json format.
Based on @Template annotation from SensioFrameworkExtraBundle and requires it.
Installation
Add bundle with composer:
composer require bu/json-response-bundle dev-master
Enable php templating engine in your symfony config:
register bundle in AppKernel.php :
Usage
Example controller:
Json template for listAction:
Also there is simple JsonResponse class that can be used if you already have data prepared:
As of Symfony 2.7 there is similar internal class Symfony\Component\HttpFoundation\JsonResponse https://symfony.com/doc/2.7/components/http_foundation.html#creating-a-json-response
License
This bundle is under the MIT license.
All versions of json-response-bundle with dependencies
symfony/framework-bundle Version >=2.1,<2.4-dev
sensio/framework-extra-bundle Version 2.3.*