onemustwork/hydrator

This package is abandoned and no longer maintained. The author suggests using the onemustcode/hydrator package instead.

Easy to use hydrator to hydrate objects from an array or extract objects to an array.

v0.1.3 2017-01-08 18:45 UTC

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