Download the PHP package eag/easy-hydrator without Composer
On this page you can find all versions of the php package eag/easy-hydrator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eag/easy-hydrator
More information about eag/easy-hydrator
Files in eag/easy-hydrator
Package easy-hydrator
Short Description Hydrate arrays to objects easily with PHP 8.0 and constructor injection
License MIT
Informations about the package easy-hydrator
Hydrate Arrays to Objects
- easy!
- PHP 8.0 support
- constructor injection support
- auto-resolving of
DateTimeInterface
string value - auto-retype based on param type declarations
- nested objects support
- customizable objects creation
- cached
Install
Add to config/bundles.php
:
Usage
Having value object with constructor injection:
Use hydrator with array like this:
Multiple Value Objects?
This is how you hydrate 1 item:
But how can we hydrate multiple items?
Optionable values
If object has optional parameters, and some of their values are not provided in data, default value is used in the hydrated object.
Missing constructor data
When not provided data for required constructor parameter, EAG\EasyHydrator\Exception\MissingDataException
is thrown.
Report Issues
In case you are experiencing a bug or want to request a new feature head over to the Symplify monorepo issue tracker
Contribute
The sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on symplify/symplify.
All versions of easy-hydrator with dependencies
nette/utils Version ^3.2|^4.0
phpstan/phpdoc-parser Version ^0.5|^1.2
symfony/config Version ^6.4|^7.0
symfony/dependency-injection Version ^6.4|^7.0
symfony/framework-bundle Version ^6.4|^7.0
symfony/http-kernel Version ^6.4|^7.0
symfony/string Version ^6.4|^7.0