Skip to content

Extra Serialization formats for symfony

License

Notifications You must be signed in to change notification settings

mihai-stancu/serializer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4d96f94 · May 23, 2017

History

18 Commits
Dec 2, 2015
Apr 15, 2016
May 23, 2017
Apr 15, 2016
Apr 13, 2016
Sep 21, 2015
Sep 21, 2015
Dec 2, 2015
Dec 2, 2015
Apr 15, 2016
Dec 2, 2015

Repository files navigation

Serializer

Contents

A recursive normalizer that uses symfony/property-info to deduce data types of elements in an object graph.

A type hinted normalizer that retains type information about the object graph being normalized.

A collection of (symfony compliant) encoders for the following formats:

Installation

Choose one ore more encoding formats from the suggestions in composer.json. If the chosen format is described below as PHP extension you will have to install said extension. If it is a pure PHP implementation you will be able to require it via composer.

composer require mihai-stancu/serializer
composer require your-chosen/encoder-package
// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new MS\SerializerBundle\MSSerializerBundle(),
    // ...
);

Usage

After having installed the bundle and at least one of the suggested encoding formats, that encoding format will be registered as a serialization format for the symfony/serializer.

$encoderName = array_rand(
    array(
        'bencode', 
        'bson', 
        'cbor',
        'export',
        'form',
        'igbinary',
        'ini',
        'msgpack',
        'rison',
        //'sereal',
        'serial',
        //'smile',
        'tnetstring',
        'ubjson',
        'yaml',
    )
);

$serializer = $container->get('serializer');
$string = $serializer->serialize($data, $encoderName);
$data = $serializer->unserialize($data, $class, $encoderName);

About

Extra Serialization formats for symfony

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages