2017 © Pedro Peláez
 

library silex-jms-serializer-provider

A silex service provider that integrates jms/serializer into silex

image

jdesrosiers/silex-jms-serializer-provider

A silex service provider that integrates jms/serializer into silex

  • Wednesday, July 20, 2016
  • by jdesrosiers
  • Repository
  • 1 Watchers
  • 10 Stars
  • 51,494 Installations
  • PHP
  • 3 Dependents
  • 1 Suggesters
  • 7 Forks
  • 0 Open issues
  • 7 Versions
  • 6 % Grown

The README.md

silex-jms-serializer-provider

Build Status Scrutinizer Code Quality Code Coverage, (*1)

silex-jms-serializer-provider is a silex service provider that integrates JmsSerializer into silex., (*2)

Installation

Install the silex-jms-serializer-provider using composer. This project uses sematic versioning., (*3)

{
    "require": {
        "jdesrosiers/silex-jms-serializer-provider": "~1.0"
    }
}

Parameters

  • serializer.srcDir: (string) The path to the jms/serializer component.
  • serializer.annotationReader: (AnnotationReader) Set a custom AnnotationReader.
  • serializer.cacheDir: (string) Set a directory for caching annotations.
  • serializer.configureHandlers: (Closure) Override the default handlers.
  • serializer.configureListeners: (Closure) Override the default listeners.
  • serializer.objectConstructor: (ObjectConstructorInterface) Set a custom ObjectConstructor.
  • serializer.namingStrategy: (string) Set the PropertyNamingStrategy
  • serializer.namingStrategy.separator: (string) If CamelCase is chosen as the NamingStrategy, you can override the default separator.
  • serializer.namingStrategy.lowerCase: (boolean) If CamelCase is chosen as the NamingStrategy, you can override the lowerCase option.
  • serializer.serializationVisitors: (array<string:VisitorInterface>) Override the default serialization visitors.
  • serializer.deserializationVisitors: (array<string:VisitorInterface>) Override the default deserialization visitors.
  • serializer.includeInterfaceMetadata: (boolean) Whether to include the metadata from the interfaces
  • serializer.metadataDirs: (array) Sets a map of namespace prefixes to directories.

Services

  • serializer: A Serializer object constructed with all of parameters given.
  • serializer.builder: If all of the shortcuts provided are not sufficient, you can always get the SerializerBuilder object and add additional customizations before the Serializer object is constructed.
  • serializer.propertyNamingStrategy: The PropertyNamingStrategy object that is generated by the provider. You shouldn't need to use it unless you are doing something fancy with the builder.

Registering

$app->register(new JDesrosiers\Silex\Provider\JmsSerializerServiceProvider(), array(
    "serializer.srcDir" => __DIR__ . "/vendor/jms/serializer/src",
));

Usage

The Serializer documentation can be found at http://jmsyst.com/libs/serializer., (*4)

$app->get("/foo", function () use ($app) {
    $foo = new Foo();
    return $app["serializer"]->serialize($foo, "json");
});

Using the Builder

You can use the builder directly to add additional customizations, (*5)

$app->register(new JDesrosiers\Silex\Provider\JmsSerializerServiceProvider(), array(
    "serializer.srcDir" => __DIR__ . "/vendor/jms/serializer/src",
//    "serializer.namingStrategy" => "IdenticalProperty",
));
$app["serializer.builder"]->setPropertyNamingStrategy(new IdenticalPropertyNamingStrategy());

Adding Custom Handlers

$closure = Pimple::protect(
    function(JMS\Serializer\Handler\HandlerRegistry $registry) {
        $registry->registerHandler('serialization', 'MyObject', 'json',
            function($visitor, MyObject $obj, array $type) {
                return $obj->getName();
            }
        );
    }
);
$app->register(new JDesrosiers\Silex\Provider\JmsSerializerServiceProvider(), array(
    "serializer.srcDir" => __DIR__ . "/vendor/jms/serializer/src",
    "serializer.configureHandlers" => $closure,
));

The Versions

20/07 2016

v0.x-dev

0.9999999.9999999.9999999-dev

A silex service provider that integrates jms/serializer into silex

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jason Desrosiers

service silex serializer jms provider serviceprovider jmsserializer johannes schmitt schmittjoh jason desrosiers jdesrosiers

20/07 2016

v0.2.0

0.2.0.0

A silex service provider that integrates jms/serializer into silex

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jason Desrosiers

service silex serializer jms provider serviceprovider jmsserializer johannes schmitt schmittjoh jason desrosiers jdesrosiers

20/07 2016

dev-master

9999999-dev

A silex service provider that integrates jms/serializer into silex

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jason Desrosiers

service silex serializer jms provider jmsserializer

20/07 2016

v1.1.0

1.1.0.0

A silex service provider that integrates jms/serializer into silex

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jason Desrosiers

service silex serializer jms provider jmsserializer

06/06 2016

v1.0.0

1.0.0.0

A silex service provider that integrates jms/serializer into silex

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jason Desrosiers

service silex serializer jms provider jmsserializer

19/12 2014

v0.1.1

0.1.1.0

A silex service provider that integrates jms/serializer into silex

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jason Desrosiers

service silex serializer jms provider serviceprovider jmsserializer johannes schmitt schmittjoh jason desrosiers jdesrosiers

21/02 2014

v0.1.0

0.1.0.0

A silex service provider that integrates jms/serializer into silex

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jason Desrosiers

service silex serializer jms provider serviceprovider jmsserializer johannes schmitt schmittjoh jason desrosiers jdesrosiers