1. Go to this page and download the library: Download orbiter/hydrator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
orbiter / hydrator example snippets
injectablephp
// needs implementation:
// $factory = \Orbiter\Hydrator\FactoryInterface()
$hydrator = new \Orbiter\Hydrator\Hydrator($factory);
// params = e.g. most likely used by your factory for __construct, array of params
$hydrator->make($class_name, $params);
// data = use to hydrate after instance creation, can be associative array or stdClass
// uses keys/properties as names for the property to inject
// third parameter = true ignores missing properties
$hydrator->hydrate($class, $data, false);
$hydrator->makeAndInject($class_name, $data, false, $params);
//
// for PHP-DI users:
use function DI\autowire;
use function DI\get;
$dependencies = [
Orbiter\Hydrator\BridgePHPDIFactory::class => autowire()
->constructorParameter('factory', get(DI\FactoryInterface::class)),
Orbiter\Hydrator\Hydrator::class => autowire()
->constructorParameter('factory', get(Orbiter\Hydrator\BridgePHPDIFactory::class)),
]
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.