aeviiq/data-mapper

一个动态映射对象属性之间的库。

v0.2 2020-03-19 09:55 UTC

This package is auto-updated.

Last update: 2024-08-29 05:24:43 UTC


README

原因

为了提供一个映射对象简单的方法。在最初几个版本中,这主要是为了将类似表单模型(具有可选值和设置器)映射到只读版本的对象,这可以在表单提交之后的任何过程中使用。这样,代码与表单本身保持解耦。

安装

composer require aeviiq/data-mapper

用法

// 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);