1. Go to this page and download the library: Download stratadox/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/ */
use Stratadox\Hydrator\ReflectiveHydrator;
$hydrator = ReflectiveHydrator::default();
use Stratadox\Hydrator\MutableCollectionHydrator;
$hydrator = MutableCollectionHydrator::default();
$collection = new SplFixedArray;
$hydrator->writeTo($collection, ['foo', 'bar']);
assert(2 === count($collection));
use Stratadox\HydrationMapping\IntegerValue;
use Stratadox\HydrationMapping\StringValue;
use Stratadox\Hydrator\MappedHydrator;
use Stratadox\Hydrator\ObjectHydrator;
$hydrator = MappedHydrator::using(
ObjectHydrator::default(),
StringValue::inProperty('title'),
IntegerValue::inProperty('rating'),
StringValue::inPropertyWithDifferentKey('isbn', 'id')
);
$book = new Book;
$hydrator->writeTo($book, [
'title' => 'This is a book.',
'rating' => 3,
'isbn' => '0000000001'
]);
use Stratadox\Hydrator\ObjectHydrator;
use Stratadox\Hydrator\ObserveBefore;
$hydrator = ObserveBefore::hydrating(ObjectHydrator::default(), new MyCustomObserver());
use Stratadox\Hydrator\ObjectHydrator;
use Stratadox\Hydrator\ObserveAfter;
$hydrator = ObserveAfter::hydrating(ObjectHydrator::default(), new MyCustomObserver());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.