sikessem / array-object
This package is abandoned and no longer maintained.
The author suggests using the sikessem/core package instead.
PHP array objects
1.0.0-a
2021-09-12 23:36 UTC
Requires
- php: >=8.0
README
Create typed and object-oriented arrays in PHP
Installation
Use Composer to install the image with this command:
composer require sikessem/array-object
Usage
Example code:
<?php use SIKessEm\ArrayObject\{ function map, Type }; require_once $COMPOSER_AUTOLOAD_FILE; // Replace $COMPOSER_AUTOLOAD_FILE by the path of your vendor autoload $array = [ // ... Describe your array ]; $object1 = new class { // ... Describe your first object }; $object2 = new class { // ... Describe your second object }; /* * Your can use all PHP var types : * - Boolean * - Integer * - Double * - String * - Array * - Object * - Resource */ $map_array_object = map(Type::ARRAY, Type::OBJECT); // Create a new map of type [array => object] $map_array_object->set($array, $object1); // Add a new association between $array and $object1 $map_array_object->set($array, $object2); // Set the old association of $array with $object2 $object = $map_array_object->get($array); // Get the object associated with $array into $object print_r();
Author
SIGUI Kessé Emmanuel (https://sikessem.com/) <opensource@sikessem.com> | GitLab | GitHub | npm | Composer - Packagist | Twitter
Security Reports
Please send any sensitive issue to report@sikessem.com. Thanks!