Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/indentno/array-to-object
Converts an array to an object with reference
https://github.com/indentno/array-to-object
array array-to-object laravel object php
Last synced: about 2 months ago
JSON representation
Converts an array to an object with reference
- Host: GitHub
- URL: https://github.com/indentno/array-to-object
- Owner: indentno
- License: mit
- Created: 2017-11-03T07:39:12.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-03T07:54:42.000Z (about 7 years ago)
- Last Synced: 2024-10-21T03:04:24.339Z (3 months ago)
- Topics: array, array-to-object, laravel, object, php
- Language: PHP
- Size: 3.91 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Array to object
[![Latest Version on Packagist](https://img.shields.io/packagist/v/sempro/array-to-object.svg?style=flat-square)](https://packagist.org/packages/sempro/array-to-object)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://img.shields.io/travis/Sempro/array-to-object/master.svg?style=flat-square)](https://travis-ci.org/Sempro/array-to-object)
[![Total Downloads](https://img.shields.io/packagist/dt/sempro/array-to-object.svg?style=flat-square)](https://packagist.org/packages/sempro/array-to-object)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
1. `composer require sempro/array-to-object`
## Usage```php
$data = [
'id' => 1,
'name' => 'Test',
];$object = arrayToObject($data);
$object->name; // 'Test'
```
## LicenseThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.