An alternative serializer that minimizes configuration, and is focused on DTOs instead of Entities.
Via Composer
$ composer require scato/serializer
$serializer = SerializerFacade::create();
$string = $serializer->serialize(..., 'json');
Read the docs for more examples on how to use the serializer, or jump to Advanced Usage to learn about custom type handling and custom factories.
Please see CHANGELOG for more information on what has changed recently.
$ composer test
Please see CONTRIBUTING for details.
Composite types are not supported. If your type reads array|Foo[]
or string|null
, you're out of luck.
Deserialization does not support polymorphism. If a type says Foo
, an object will never be deserialized as a subclass
of Foo
. The reason for this is that DocBlocks have no way to define discriminators. (Maybe we could use the @uses
tag to point to a property with a default value, so the property/value-pair can be used as a discriminator.)
No caching is performed, which makes deserialization relatively slow.
There is a problem with the phpdocumentor/reflection-common
component, so you have to add it to your own
composer.json
:
"require": {
"phpdocumentor/reflection-common": "^1.0@dev"
}
The MIT License (MIT). Please see License File for more information.