PHPackages                             thanhtaivtt/collection - 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. thanhtaivtt/collection

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

thanhtaivtt/collection
======================

Array collection for PHP

1.0.0(8y ago)069MITPHPPHP &gt;=5.6

Since Mar 18Pushed 8y ago1 watchersCompare

[ Source](https://github.com/thanhtaivtt/collection)[ Packagist](https://packagist.org/packages/thanhtaivtt/collection)[ Docs](http://toidicode.com)[ RSS](/packages/thanhtaivtt-collection/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Array Collection for PHP
========================

[](#array-collection-for-php)

Install
-------

[](#install)

```
composer require thanhtaivtt/collection

```

Usage
-----

[](#usage)

```
use thanhtaivtt\Collection\Collection;

//init
$collection = new Collection([1,2,3,4,5,6]);

//or
Collection::init([1,2,3,6,4]);
```

Suport Methods
--------------

[](#suport-methods)

### sum

[](#sum)

- The `sum` method returns the sum of all items in the collection:

```
    Collection::init([1, 2, 3])->sum();
    // 6
```

### sum

[](#sum-1)

- The `avg` method returns the average of all items in the collection:

```
    Collection::init([1, 2, 3])->avg();
    // 2
```

### min

[](#min)

- The `min` method returns the min of all items in the collection:

```
    Collection::init([1, 2, 3])->min();
    // 1
```

### max

[](#max)

- The `max` method returns the max of all items in the collection:

```
    Collection::init([1, 2, 3])->max();
    // 1
```

### all

[](#all)

- The `all` method returns the all items in the collection:

```
    Collection::init([1, 2, 3])->all();
    // [1,2,3]
```

### chunk

[](#chunk)

- The `chunk` method breaks the collection into multiple, smaller collections of a given length:

```
    $chunk = Collection::init([1, 2, 3])->chunk(2);
    $chunk->toArray();
    // [[1, 2], [3]]
```

### toArray

[](#toarray)

- The `toArray` method converts all items in Object to Array:

```
    $chunk = Collection::init([1, 2, 3])->toArray();
    // [1, 2, 3]
```

....

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3025d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9adbb10083b59d529dc809f5cf15d1a4792e12dd1c2218d5ebbb1289974709d2?d=identicon)[thanhtaivtt](/maintainers/thanhtaivtt)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thanhtaivtt-collection/health.svg)

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

PHPackages © 2026

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