2017 © Pedro Peláez
 

symfony-bundle serialized-response-bundle

A simple bundle to provide an easy way to send out json/xml/yaml responses of serialized objects with annotations.

image

pulpmedia/serialized-response-bundle

A simple bundle to provide an easy way to send out json/xml/yaml responses of serialized objects with annotations.

  • Sunday, August 3, 2014
  • by AlexandreKilian
  • Repository
  • 4 Watchers
  • 5 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

SerializedResponseBundle

A simple bundle to provide an easy way to send out json/xml/yaml responses of serialized objects with annotations., (*1)

Introduction

This Bundle allows you to directly return serializable objects as from within a controller to receive a serialized response in json/xml/yaml format. It requires jms/serializer-bundle., (*2)

Installation

Step 1

This library can be easily installed via composer, (*3)

composer pulpmedia/serialized-response-bundle, (*4)

or just add it to your composer.json file directly. This will install the pulpmedia/serialized-response-bundle and jms/serializer if not already installed., (*5)

Step 2

Enable the bundle in the kernel:, (*6)

``` php <?php // app/AppKernel.php, (*7)

public function registerBundles() { $bundles = array( new JMS\SerializerBundle\JMSSerializerBundle(), //If you have not already done this already // ... new Pulpmedia\SerializedResponseBundle\PulpmediaSerializedResponseBundle(), ); }, (*8)


##Usage Using the Bundle is as easy as it comes. By returning the Object that should be serialized and using the corresponding annotation; ``` php <?php namespace My\Bundle\Controller use Pulpmedia\SerializedResponseBundle\Annotation\SerializedResponse; // ... class MyController extents Controller{ /** * @Route("/get/{id}") * @SerializedResponse(format="json/xml/yaml") */ public function getAction($id){ $em = $this->getDoctrine()->getManager(); if($object = $em->getRepository('MyBundle:Entity')->find($id)){ return $object; } return null; } }

The Versions

03/08 2014

dev-master

9999999-dev https://github.com/Pulpmedia/SerializedResponseBundle

A simple bundle to provide an easy way to send out json/xml/yaml responses of serialized objects with annotations.

  Sources   Download

MIT

The Requires

 

by Alexandre Kilian

json xml response serialize jms yml