ExtendedArray for PHP

Jun 18, 2015 min read

Today I released an ExtendedArray for PHP, you can check It out in Github.

An example:

use TA\ExtendedArray\Type\ExtendedArray;

$fruits = new ExtendedArray(
        'tropical' => 'pineapple',
        'farm'     => 'strawberry'


// true

$fruits->hasOne(array('tropical', 'asian'));

// true

$fruits->hasAll(array('tropical', 'asian'));

// false

$fruits->get('canary', 'banana');

// 'banana'

$fruits->get('tropical', 'banana');

// 'pineapple'


// array('tropical' => 'pineapple');


// array('tropical' => 'pineapple', 'farm' => 'strawberry');

You can access the keys as an object or as an array.


// 'pineapple'


// 'pineapple'

There is more than one way of accessing the properties, I want to give flexibility, but I know there should be only one (obvious) way to use It, feel free to select your way of access.

It uses ArrayObject underneath and You can install ExtendedArray through composer. :-)