cjrasmussen / objectify
Simple functions for converting associative arrays to objects and vice-versa
1.0.0
2024-06-30 01:58 UTC
Requires
- php: >=7.4.0
- ext-json: *
Requires (Dev)
- phpunit/phpunit: ^9.6
- roave/security-advisories: dev-latest
README
Simple functions for converting associative arrays to objects and vice-versa.
There are better ways to do this for specific cases but this covers some extremely general cases easy enough.
Usage
use cjrasmussen\Objectify\Objectify; $array = [ 'foo' => 'bar', 'baz' => [ 'alpha' => 1, 'beta' => 2, ], ]; $object = Objectify::toObject($array);
Installation
Simply add a dependency on cjrasmussen/objectify to your composer.json file if you use Composer to manage the dependencies of your project:
composer require cjrasmussen/objectify
Although it's recommended to use Composer, you can actually include the file(s) any way you want.
License
Objectify is MIT licensed.