mihai-stancu / serializer
Customized normalizers and a collection of encoders.
Installs: 50 079
Dependents: 1
Suggesters: 0
Security: 0
Stars: 7
Watchers: 2
Forks: 0
pkg:composer/mihai-stancu/serializer
Requires
- php: >=5.4
- symfony/config: ^2|^3
- symfony/dependency-injection: ^2|^3
- symfony/http-kernel: ^2|^3
- symfony/property-info: ^2.8|^3
- symfony/serializer: ^2|^3|^3@dev
Requires (Dev)
- php: >=5.5
- 2tvenom/cborencode: dev-master@dev
- dizews/php-ubjson: dev-master@dev
- doctrine/orm: ^2|^3
- fzaninotto/faker: ^1
- kunststube/rison: dev-master@dev
- mihai-stancu/sereal: dev-master@dev
- phpunit/phpunit: ^5
- phuedx/tnetstring: dev-master@dev
- rych/bencode: dev-master@dev
- symfony/yaml: ^2|^3
- zendframework/zend-config: ^2
Suggests
- ext-igbinary: ^1.2
- ext-mongo: ^1.6
- ext-msgpack: ^0.5
- ext-yaml: ^1.2
- 2tvenom/cborencode: dev-master
- dizews/php-ubjson: dev-master
- doctrine/orm: ^2|^3
- kunststube/rison: dev-master
- mihai-stancu/sereal: dev-master
- phuedx/tnetstring: dev-master
- rych/bencode: dev-master
- symfony/yaml: ^2|^3
- zendframework/zend-config: ^2
This package is not auto-updated.
Last update: 2025-10-26 00:09:50 UTC
README
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:
- Bencode as a pure PHP implementation provided by rych/bencode.
- BSON as a PHP extension provided by the
mongoextension. - CBOR as a pure PHP implementation provided by 2tvenom/cborencode.
- Export as a PHP core functionality.
- Form as a PHP core functionality.
- IGBinary as a PHP extension provided by the
igbinaryextension -- as a drop-in replacement forPHP Serialize. - Ini PHP implementation provided by zendframework/zend-config.
- MsgPack as a PHP extension provided by the
msgpackextension. - Rison as a pure PHP implementation provided by deceze/Kunststube-Rison.
//Serealas a pure PHP implementation provided by tobyink/sereal.- Serialize as a PHP core functionality.
//Smileas a PHP extension provided by thelibsmileextension.- Tnetstring as a pure PHP implementation provided by phuedx/tnetstring.
- UBJSON as a pure PHP implementation provided by dizews/php-ubjson.
- YAML as a PHP extension provided by the
yamlextension or a pure PHP implementation provided by symfony/yaml.
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);