PHPackages                             zerifas/collections - 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. zerifas/collections

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

zerifas/collections
===================

Tools for collections of data in PHP

v1.1.0(9y ago)02091Apache-2.0PHPPHP &gt;= 5.5

Since Nov 2Pushed 9y agoCompare

[ Source](https://github.com/Drarok/collections)[ Packagist](https://packagist.org/packages/zerifas/collections)[ RSS](/packages/zerifas-collections/feed)WikiDiscussions develop Synced 3w ago

READMEChangelogDependencies (2)Versions (3)Used By (1)

Collections
===========

[](#collections)

Tools for collections of data in PHP.

Installation
------------

[](#installation)

```
$ composer require zerifas/collections

```

Usage
-----

[](#usage)

There are two ways to use this library:

- The `Arr` helper class that consists of static methods. The first parameter is always to array to operate on.
- The `ArrayWrapper` class that wraps a plain array in an [`ArrayObject`](http://php.net/manual/en/class.arrayobject.php)

### `Arr` helper

[](#arr-helper)

#### Get a single item

[](#get-a-single-item)

```
use Zerifas\Collections\Arr;

$arr = [
    'key1' => 'value1',
    'key2' => 'value2',
];
$item = Arr::get($arr, 'key1'); // 'value1'
$item = Arr::get($arr, 'NONE'); // null
$item = Arr::get($arr, 'NONE', 'default value'); // 'default value'
```

#### Filter and Map

[](#filter-and-map)

Example:

```
use Zerifas\Collections\Arr;

$arr = [
    'key1' => 1,
    'key2' => 2,
    'key3' => 3,
];

$filtered = Arr::filter($arr, function ($value, $key) {
    return $key !== 'key1';
});
$mapped = Arr::map($filtered, function ($value, $key) {
    return 'value ' . $value;
});
var_dump($mapped);
```

Outputs:

```
array(2) {
  'key2' =>
  string(7) "value 2"
  'key3' =>
  string(7) "value 3"
}

```

### ArrayWrapper class

[](#arraywrapper-class)

#### Get a single item

[](#get-a-single-item-1)

```
use Zerifas\Collections\ArrayWrapper;

$arr = new ArrayWrapper([
    'key1' => 'value1',
    'key2' => 'value2',
]);
$item = $arr->get('key1'); // 'value1'
$item = $arr->get('NONE'); // null
$item = $arr->get('NONE', 'default value'); // 'default value'
```

#### Filter and Map

[](#filter-and-map-1)

Example:

```
use Zerifas\Collections\ArrayWrapper;

$arr = [
    'key1' => 1,
    'key2' => 2,
    'key3' => 3,
];
$result = (new ArrayWrapper($arr))
    ->filter(function ($value, $key) {
        return $key !== 'key1';
    })
    ->map(function ($value, $key) {
        return 'value ' . $value;
    })
    ->toArray()
;

var_dump($result);
```

Outputs:

```
array(2) {
  'key2' =>
  string(7) "value 2"
  'key3' =>
  string(7) "value 3"
}

```

You can also wrap a plain array using the `Arr` helper:

```
$arr = [1, 2, 3];
$result = Arr::wrap($arr)->filter(function (…) { … })->toArray();
```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

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 ~0 days

Total

2

Last Release

3521d ago

PHP version history (2 changes)v1.0.0PHP &gt;= 5.6

v1.1.0PHP &gt;= 5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/c2fecfeadca598be917b367e724355b2ca1bef3611ca1bc4ad65435674a7e9d4?d=identicon)[Drarok](/maintainers/Drarok)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/zerifas-collections/health.svg)

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

PHPackages © 2026

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