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

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

fiv/collection
==============

Easy way to iterate over your data

0.0.1(11y ago)028.9kMITPHPPHP &gt;=5.3.0

Since Nov 7Pushed 10y ago1 watchersCompare

[ Source](https://github.com/funivan/collection)[ Packagist](https://packagist.org/packages/fiv/collection)[ Docs](https://github.com/funivan/object-collection)[ RSS](/packages/fiv-collection/feed)WikiDiscussions master Synced 1mo ago

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

Collection
==========

[](#collection)

[![Latest Version](https://camo.githubusercontent.com/39925d6c8f0197e5086065b5006ea30dc0815f4d831b2f5b4654e324121fa873/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f66756e6976616e2f636f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/funivan/collection/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/936e83495afb58255b40a32c2c242a7aaece728cbc4e6c3047c119fb74da66e2/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f66756e6976616e2f636f6c6c656374696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/funivan/collection)[![Coverage Status](https://camo.githubusercontent.com/0c6d46ed49c91a32ee58fe7f9bf43473e72a9edb8fe2bdd67420e714fc7f9637/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f66756e6976616e2f636f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/funivan/collection/code-structure)[![Quality Score](https://camo.githubusercontent.com/e98fbb94db3c72dc5bfcb54b14af4c1f429ff10aca57e35b774a447cf507d929/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f66756e6976616e2f636f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/funivan/collection)[![Total Downloads](https://camo.githubusercontent.com/63c0cd258d1a28006fda4fb30106bcb51de2976696b520e404f351a76619e59b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66756e6976616e2f636f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/funivan/collection)

Manipulate array of items in OOP style. `ObjectCollection` - contain/manipulate objects only with specific class `TypedCollection` - contain/manipulate items with defined validation rule `BaseCollection` - contain/manipulate any items

`ObjectCollection` it the most useful collection. You can specify class of object and add only this objects. All validations perform `ObjectCollection` Other data types restricted. This class guarantee strict type data.

Install
-------

[](#install)

Via Composer

```
$ composer require fiv/collection
```

Base collection usage
---------------------

[](#base-collection-usage)

```
$collection = new \Fiv\Collection\BaseCollection();
$collection[] = 1;
$collection[] = 2;
echo $skeleton->getFirst()
```

Example : ObjectCollection
--------------------------

[](#example--objectcollection)

In java there ara features like `ArrayList` in php you can extend `ObjectCollection` to `UserModelCollection` and define class name.

```
class UserModel {
  public function getName(){

  }
}

class UsersCollection extend  ObjectCollection {
  public function objectsClassName(){
    return 'UserModel';
  }
}

# ....
$users = new UserCollection();

foreach($users as $user){
  # at this point you can drop out all you validations
  # ObjectCollection guarantee that all items are UserModel
  $user->getName();
}

$users->append(123); // Fail. 123 is not instance of UserModel
```

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/funivan/collection/blob/master/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Ivan Scherbak](https://github.com/funivan)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

4210d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1ee14f8f97b3ead4c91823e410ea170293b55be64adf12a20d965f19008839a6?d=identicon)[funivan](/maintainers/funivan)

---

Top Contributors

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

---

Tags

collection

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[phpcollection/phpcollection

General-Purpose Collection Library for PHP

1.0k64.0M34](/packages/phpcollection-phpcollection)[aimeos/map

Easy and elegant handling of PHP arrays as array-like collection objects similar to jQuery and Laravel Collections

4.2k412.9k11](/packages/aimeos-map)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[loophp/collection

A (memory) friendly, easy, lazy and modular collection class.

745663.8k13](/packages/loophp-collection)[athari/yalinqo

YaLinqo, a LINQ-to-objects library for PHP

4561.2M5](/packages/athari-yalinqo)[lorisleiva/lody

Load files and classes as lazy collections in Laravel.

956.6M9](/packages/lorisleiva-lody)

PHPackages © 2026

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