2017 © Pedro Peláez
 

library silex-jms-serializer

Use JMS Serializer for (de-)serializing object graphs in silex applications

image

macedigital/silex-jms-serializer

Use JMS Serializer for (de-)serializing object graphs in silex applications

  • Friday, August 30, 2013
  • by macedigital
  • Repository
  • 1 Watchers
  • 5 Stars
  • 15,424 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 1 % Grown

The README.md

silex-jms-serializer-provider

This Silex service provider registers [JMS-Serializer][1] for (de-)serialization of object graphs of any complexity., (*1)

Installation

The preferred way of installing this service provider is through composer:, (*2)

composer.phar require macedigital/jms-serializer-provider

Example

As this is a drop-in replacement for the Silex SerializerServiceProvider this slightly adapted example from the docs will work:, (*3)

<?php
$loader = require_once __DIR__.'/../vendor/autoload.php';

// If you're are using class annotations
Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

$app = new Silex\Application();

// optional: whether to stat cached files or not, defaults to $app['debug']
$app['serializer.debug'] = true;

// optional: defaults to system's default temporary folder 
$app['serializer.cache_dir'] = '/some/writable/folder';

$app->register(new Macedigital\Silex\Provider\SerializerProvider);

// only accept content types supported by the serializer via the assert method.
$app->get("/pages/{id}.{_format}", function ($id) use ($app) {
    // assume a page_repository service exists that returns a Page object
    $page = $app['page_repository']->find($id);
    $format = $app['request']->getRequestFormat();

    if (!$page instanceof Page) {
        $app->abort("No page found for id: $id");
    }

    return new Response($app['serializer']->serialize($page, $format), 200, array(
        "Content-Type" => $app['request']->getMimeType($format)
    ));
})->assert("_format", "xml|json|yml")
  ->assert("id", "\d+");

$app->run();

The Versions

30/08 2013

1.0.0.x-dev

1.0.0.9999999-dev https://github.com/macedigital/silex-jms-serializer-provider

Use JMS Serializer for (de-)serializing object graphs in silex applications

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matthias Adler

silex serializer jms provider

30/08 2013

dev-master

9999999-dev https://github.com/macedigital/silex-jms-serializer-provider

Use JMS Serializer for (de-)serializing object graphs in silex applications

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matthias Adler

silex serializer jms provider

30/08 2013

v1.0.0

1.0.0.0 https://github.com/macedigital/silex-jms-serializer-provider

Use JMS Serializer for (de-)serializing object graphs in silex applications

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matthias Adler

silex serializer jms provider