PHPackages                             zihad/easyarray - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. zihad/easyarray

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

zihad/easyarray
===============

A simple php package to handle your array easily and elegantly

1.0.1(3y ago)11.9kMITPHP

Since Mar 20Pushed 3y ago1 watchersCompare

[ Source](https://github.com/muhammadZihad/easyarray)[ Packagist](https://packagist.org/packages/zihad/easyarray)[ RSS](/packages/zihad-easyarray/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

EasyArray
=========

[](#easyarray)

This package will allow developers to interact with complex and nested arrays easily. Any array can be converted into an EasyArray object and then access the array items like object properties.

Installation:
=============

[](#installation)

`composer require zihad/easyarray`

Usage
=====

[](#usage)

Basics
------

[](#basics)

```
use Zihad\Easyarray\EasyArray;

$testArray = [
    'name' => 'Zihad',
    'stack' => 'LAMP'
];
$easyArray = new EasyArray($testArray);

// Access array items
$easyArray->name // 'Zihad'
$easyArray['stack'] // 'LAMP'
$easyArray->language // null

// Check if the value is set
isset($easyArray->name) // true
isset($easyArray['stack']) // true
isset($easyArray['lang']) // false

// Unset value
unset($easyArray['name']);
unset($easyArray->name);
isset($easyArray->name) // false
$easyArray->name // null

// Iterating throught the array
foreach($easyArray as $key => $value) {
    echo "$key -> $value\n";
}
// Output
name -> Zihad
stack -> LAMP

// Working with nested array
$testArray = [
    'name' => 'Zihad',
    'stack' => [
        'lang' => 'PHP',
        'framework' => 'Laravel'
    ]
];
$easyArray = new EasyArray($testArray, true); // secord parameter is a flag to indicate if it is a nested array or not

$easyArray->stack->framework // 'Laravel'
isset($easyArray->stack->lang) // true

$easyArray->toArray()
//Output
[
    'name' => 'Zihad',
    'stack' => [
        'lang' => 'PHP',
        'framework' => 'Laravel'
    ]
]

$easyArray->stack->toArray()
// Output
[
    'lang' => 'PHP',
    'framework' => 'Laravel'
]

// You can also use helper function to create a new instance of EasyArray
$easyArray = easyArray([
    'name' => 'Zihad',
    'stack' => [
        'lang' => 'PHP',
        'framework' => 'Laravel'
    ]
]);

```

Iterations
----------

[](#iterations)

```
// You can use EasyArray in foreach and nested foreach loops
$easyArray = easyArray([
    'phones' => [
        'featured' => [
            'used' => [
                'Nokia 3310',
                'Oppo'
            ],
            'fresh' => [
                'Nokia 1110',
                'Huawei 11'
            ]
        ],
        'smartphone' => [
            'used' => [
                'iPhone 11',
                'Samsung s20'
            ],
            'fresh' => [
                'iPhone 13 pro',
                'One plus 9'
            ]
        ]
    ]
], true);

foreach ($easyArray as $category) {
    foreach ($category as $name => $subCategory) {
        foreach ($subCategory as $index => $phones) {
            var_dump(sprintf(
                "%s > %s phones: %s",
                ucfirst($name),
                ucfirst($index),
                implode(', ', $phones->toArray())
            ));
        }
    }
}

```

Array operations
----------------

[](#array-operations)

```
// Count the total number of elements
$easyArray = easyArray([
    'used' => [
        'iPhone 11',
        'Samsung s20'
    ],
    'fresh' => [
        'iPhone 13 pro',
        'One plus 9'
    ]
]);
count($easyArray) // 2
$easyArray->count() // 2

// Array push() method
$easyArray = easyArray([
    'used' => [
        'iPhone 11',
        'Samsung s20'
    ],
    'fresh' => [
        'iPhone 13 pro',
        'One plus 9'
    ]
], true);

$easyArray->used->push('Pixel 5');
$easyArray->used->count() // 3

// Array pop() method
$easyArray = easyArray([
    'used' => [
        'iPhone 11',
        'Samsung s20'
    ]
]);

$easyArray->merge([
    'fresh' => [
        'iPhone 13 pro',
        'One plus 9'
    ]
]);

$easyArray->fresh == null; // false
$easyArray->pop();
$easyArray->fresh == null; // true

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

2

Last Release

1149d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/92dbbe5f72d83b730f25172eb74d25b2f317ec63331561b3cc069fe21af53dc8?d=identicon)[muhammadZihad](/maintainers/muhammadZihad)

---

Top Contributors

[![muhammadZihad](https://avatars.githubusercontent.com/u/48516246?v=4)](https://github.com/muhammadZihad "muhammadZihad (12 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/zihad-easyarray/health.svg)

```
[![Health](https://phpackages.com/badges/zihad-easyarray/health.svg)](https://phpackages.com/packages/zihad-easyarray)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
