onemustcode / hydrator
Hydrator to map or extract an extract object
Installs: 27 221
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=5.6.4
- symfony/property-access: ^3.2
- symfony/serializer: ^3.2
This package is auto-updated.
Last update: 2024-12-04 22:02:10 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 onemustcode/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 object to an array you can use the extract method;
$array = $hydrator->extract($object);
Todo
- Add strategies
- Add unit tests