aeviiq / data-mapper
A library that dynamically maps properties between objects.
Installs: 5 147
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: ^7.2
- aeviiq/safe-cast: ^0.1
This package is auto-updated.
Last update: 2024-12-29 06:08:32 UTC
README
Why
To provide an easy way to map objects. In the first few releases this is mainly made to map something like a form model, which has optional values and setters, to a read-only version of the object, which could be used in whatever process comes after the form submission. This way the code stays decoupled from the form itself.
Installation
composer require aeviiq/data-mapper
Usage
// The target can be either an object or a string representing the class name of the object you want to map to DynamicDataMapper::map($source, Foo::class); DynamicDataMapper::map($source, $foo);