PHP code example of kwizer / hydrator

1. Go to this page and download the library: Download kwizer/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/ */

    

kwizer / hydrator example snippets


class MyClass
{
    private $foo;
}

$myDatas = ['foo' => 'bar'];
$hydrator = new \Kwizer\Hydrator\Hydrator();
$myObject = $hydrator->hydrate(MyClass::class, $myDatas);

$myObject = new MyClass();
$myObject = $hydrator->hydrate($myObject, $myDatas);

$datas = new \stdClass();
$datas->foo = 'bar';
$myObject = $hydrator->hydrate(MyClass::class, $myDatas);