Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pew-pew-team/hydrator
Hydrator kernel component
https://github.com/pew-pew-team/hydrator
data deserializer dto hydrator kernel mapper mapping serializer structure
Last synced: about 1 month ago
JSON representation
Hydrator kernel component
- Host: GitHub
- URL: https://github.com/pew-pew-team/hydrator
- Owner: pew-pew-team
- License: mit
- Created: 2024-03-17T11:22:20.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-03-17T12:55:20.000Z (10 months ago)
- Last Synced: 2024-11-20T20:16:16.561Z (about 2 months ago)
- Topics: data, deserializer, dto, hydrator, kernel, mapper, mapping, serializer, structure
- Language: PHP
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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:```bash
$ composer require pew-pew/hydrator
```More detailed installation [instructions are here](https://getcomposer.org/doc/01-basic-usage.md).
## Usage
```php
$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(),
);
```