monii / reflection-properties-serializer
Reflection Properties Serializer
Requires
- php: >=5.5
Requires (Dev)
- phpunit/phpunit: ^4.7
- squizlabs/php_codesniffer: ^2.3
This package is auto-updated.
Last update: 2024-10-29 04:09:25 UTC
README
A simple serializer that is completely controlled by PSR-5 @var
typehints.
Requirements
- PHP 5.5+
Installation
$> 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.
Limitations
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
@var
syntax. - We make a best guesss effort to support the right implementation of multiple
@var
types are listed. - We cannot deserialize objects from different types to the same property (meaning interfaces-only
@var
typehints are going to give you a hard time).
License
MIT, see LICENSE.
Community
Want to get involved? Here are a few ways:
- Find us in the #monii IRC channel on irc.freenode.org.
- Mention @moniidev on Twitter.