sempro / array-to-object
Convert an array to an 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-12-11 17:20:58 UTC
README
Gives you a global function that converts arrays to objects without removing object references. The object also implements Jsonable which will prettify the output if the object is returned (This only works in Laravel).
Installation
composer require sempro/array-to-object
Usage
$data = [ 'id' => 1, 'name' => 'Test', ]; $object = arrayToObject($data); $object->name; // 'Test'
License
The MIT License (MIT). Please see License File for more information.