mrself / sync
There is no license information available for the latest version (v2.0.0) of this package.
v2.0.0
2021-09-19 14:14 UTC
Requires
- mrself/data-transformers: ^1.2
- mrself/options: ^2.19.5
- mrself/property: ^1.7
- mrself/util: ^1.12
- psr/log: ^1.1
- symfony/validator: ^5.2
Requires (Dev)
- doctrine/annotations: ^1.6
- doctrine/cache: ^1.8
- phpunit/phpunit: ^7.5
- symfony/var-dumper: ^4.4
Suggests
- doctrine/annotations: Requires for annotation metadata for validation
- doctrine/cache: Requires for annotation metadata for validation
README
// From array to array $sync = Sync::make([ 'source' => ['a' => 1], 'target' => [], 'mapping' => ['a'] ]); $sync->getTarget()['a'] === 1; // ======= // From array to object $targetObject = (object) []; $sync = Sync::make([ 'source' => ['a' => 1], 'target' => $targetObject, 'mapping' => ['a'] ]); $targetObject->a === 1; // ======= // Extending from Sync // Formatting values $target = []; $source = ['a' => 1]; $mapping = ['a']; $sync = new class extends Sync { public function formatA($value) { return $value + 1; } }; $sync->init(compact('target', 'source', 'mapping')); $sync->sync();