Very simple Serializer/Unserializer for PHP objects.
If we have this very simple class:
<?php
class Person {
private $name;
public function getName() { return $this->name; }
public function setName($name) { $this->name = $name; }
}
Then we can easy create new Person object from a structured array:
<?php
$person = new Person();
$person->setName('Johnson American');
(new AndyTruong\Serializer\Serializer())
->toArray($person); // ['name' => 'Johnson American']
We can also easy create new Person object from a structured array:
<?php
$person = (new AndyTruong\Serializer\Unserializer())
->fromArray(['name' => 'Johnson America']);
The library also supports Trait, nested objects, … check ./resources/docs for more informations.