Data collection manager
This library is lightweight collection manager., (*1)
Diclaimer : This component is part of the WOK (Web Operational Kit) framework. It however can be used as a standalone library., (*3)
It is recommanded to install that component as a dependency using Composer :, (*4)
composer require wok/collection
You're also free to get it with git or by direct download while this package has no dependencies., (*5)
git clone https://github.com/web-operational-kit/collection.git
As this component roles are to be a data container and manager, it's features are related to collection data manipulation., (*6)
However, it has also been developed to be a dependency that other components can require and extend., (*7)
``` php // Register the data collection $collection = new \WOK\Collection\Collection(array( 'a' => 'value', 'b' => 'value', 'c' => 'value', ));, (*8)
$collection->add(array('key'=>'value')); // Add some data, (*9)
$exists = $collection->has($key); // Check if a data exists by it's key $value = $collection->get($key); // Get a data value by it's key $collection->remove($key); // Remove a data, (*10)
$data = $collection->all(); // Get the all data collection as array, (*11)
// Iterate through the collection foreach($collection as $key => $data) {, (*12)
// Play with the data list
} ```, (*13)