onemustwork / hydrator
Easy to use hydrator to hydrate objects from an array or extract objects to an array.
Installs: 57
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/onemustwork/hydrator
Requires
- php: >=5.6.4
- symfony/property-access: ^3.2
- symfony/serializer: ^3.2
This package is not auto-updated.
Last update: 2022-02-01 13:03:53 UTC
README
Simple to use hydrator to hydrate an object from array or extract an object to an array.
Usage
To install the hydrator use the following command;
composer require onemustwork/hydrator
Hydrating
To hydrate an object you can use the hydrate method;
$object = new Object(); // The object to hydrate $data = ['some_field' => 'some_value', 'boolean_field' => true]; $object = $hydrator->hydrate($object, $data);
Extracting
To extract an entity to an array you can use the extract method;
$array = $hydrator->extract($object);
Todo
- Add strategies
- Add unit tests