pew-pew / hydrator
Object hydrator kernel library
Installs: 1 777
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.3
- psr/log: ^1.0|^2.0|^3.0
- symfony/stopwatch: ^5.4|^6.0|^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.49
- phpunit/phpunit: ^10.5
- symfony/var-dumper: ^5.4|^6.0|^7.0
- vimeo/psalm: ^5.21
This package is auto-updated.
Last update: 2024-11-23 12:39:04 UTC
README
Hydrator
A set of interfaces for mapping arbitrary values to their typed equivalents and their inverses.
Installation
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.
Usage
$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(), );