A set of interfaces for mapping arbitrary values to their typed equivalents and their inverses.
PewPew Hydrator is available as Composer repository and can be installed using the following command in a root of your project:
$ composer require pew-pew/hydrator
More detailed installation instructions are here.
$hydrator = new class implements \PewPew\Hydrator\HydratorInterface {
public function hydrate(string $type, mixed $data): mixed
{
return ...;
}
};
$hydrator = new \PewPew\Hydrator\TraceableHydrator(
hydrator: $hydrator,
stopwatch: new \Symfony\Component\Stopwatch\Stopwatch(),
);
$hydrator = new \PewPew\Hydrator\LoggableHydrator(
hydrator: $hydrator,
logger: new ExampleLogger(),
);