Reflection Properties Serializer
Installs: 1 776
- php: >=5.5
- phpunit/phpunit: ^4.7
- squizlabs/php_codesniffer: ^2.3
This package is auto-updated.
Last update: 2023-03-29 00:24:42 UTC
A simple serializer that is completely controlled by PSR-5
- PHP 5.5+
$> composer require monii/reflection-properties-serializer
Until a stable version has been released or if a development version is preferred, use:
$> composer require monii/reflection-properties-serializer:@dev
Goals and Target Use Cases
The goal of this package is to provide a simple strategy for serializing simple value objects that contain primitives and other value objects.
The target use case for this project is serializing and deserializing commands and events comprised of simple value objects.
We wanted to minimize the amount of configuration and work that needs to be done to serialize and deserialize events and commands in environments where these are simple immutable value objects.
It was our hope we could do this entirely with
@var typehints and we are going to see how far this takes us before falling back on heavier solutions like Symfony Serializer or JMS Serializer.
This package is intentionally simple and strives to use as few dependencies as possible. This means that there are some limitations that we are going to accept until we find a reason to address them.
- All properties need to be typehinted using PSR-5
- We make a best guesss effort to support the right implementation of multiple
@vartypes are listed.
- We cannot deserialize objects from different types to the same property (meaning interfaces-only
@vartypehints are going to give you a hard time).
MIT, see LICENSE.
Want to get involved? Here are a few ways:
- Find us in the #monii IRC channel on irc.freenode.org.
- Mention @moniidev on Twitter.