sempro / array-to-object
将数组转换为对象
1.0.0
2017-11-03 07:38 UTC
Requires
- illuminate/contracts: ^5.0
Requires (Dev)
- phpunit/phpunit: ^6.4
This package is auto-updated.
Last update: 2024-09-11 16:47:00 UTC
README
提供全局函数,用于将数组转换为对象,而不会移除对象引用。该对象还实现了Jsonable接口,如果对象被返回,将美化输出(这仅在Laravel中有效)。
安装
composer require sempro/array-to-object
使用方法
$data = [ 'id' => 1, 'name' => 'Test', ]; $object = arrayToObject($data); $object->name; // 'Test'
许可证
MIT许可证(MIT)。请参阅许可证文件获取更多信息。