rkr/array-object-converter
最新稳定版本:1.0.5.2
Composer 安装命令:
composer require rkr/array-object-converter
包简介
A module to copy data from an array to an object, vice versa.
README 文档
README
A module to copy data from an array into an object, vice versa. Requires PHP 5.4+.
You have to provide information for targeted objects to describe how properties are connected to array keys. This is done through "SpecificationProvider"s.
Right now there is just one provider ready: The PhpDocSpecificationProvider extracts the annotations from the object's methods. Other providers may follow, if I find some time for that.
If all objects are equipped with propper annotations, you can do this:
$array = (new ArrayObjectConverter($entity))->getArray();
Or the other way around:
$object = (new ArrayObjectConverter($entity))->setArray($array);
统计信息
- 总下载量: 4.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-12-19