PHPackages                             yiisoft/yii2-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. [Framework](/categories/framework)
4. /
5. yiisoft/yii2-collection

ActiveYii2-extension[Framework](/categories/framework)

yiisoft/yii2-collection
=======================

Active Record Collection implementation for the Yii framework

683.1k↓33.3%18[9 issues](https://github.com/yiisoft/yii2-collection/issues)[1 PRs](https://github.com/yiisoft/yii2-collection/pulls)PHPCI passing

Since Feb 9Pushed 3mo ago23 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

 [ ![](https://avatars0.githubusercontent.com/u/993323) ](https://github.com/yiisoft)

ActiveRecord Collection Extension for Yii 2
===========================================

[](#activerecord-collection-extension-for-yii-2)

This extension provides a generic data collection as well as a collection for the ActiveRecord DB layer of Yii 2.

**Development is currently in experimental state. It is not ready for production use and may change significantly.**

For license information check the [LICENSE](LICENSE.md)-file.

Documentation is at [docs/guide/README.md](docs/guide/README.md).

[![Latest Stable Version](https://camo.githubusercontent.com/2a4593ec195f9db33dc38ef26b75ea21d7025208186af5bd359ee6716ce77194/68747470733a2f2f706f7365722e707567782e6f72672f796969736f66742f796969322d636f6c6c656374696f6e2f762f737461626c652e706e67)](https://packagist.org/packages/yiisoft/yii2-collection)[![Total Downloads](https://camo.githubusercontent.com/af89c862086f7fc6ef7a464cb1763d89a117f91857184890d498bac29b6c110b/68747470733a2f2f706f7365722e707567782e6f72672f796969736f66742f796969322d636f6c6c656374696f6e2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/yiisoft/yii2-collection)[![Build Status](https://github.com/yiisoft/yii2-collection/workflows/build/badge.svg)](https://github.com/yiisoft/yii2-collection/actions)[![codecov](https://camo.githubusercontent.com/4892f3497969a4500777f7c7533e2036ee76579b41a68cd89a8870adceaa5834/68747470733a2f2f636f6465636f762e696f2f67682f796969736f66742f796969322d636f6c6c656374696f6e2f67726170682f62616467652e737667)](https://codecov.io/gh/yiisoft/yii2-collection)

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

[](#installation)

Important

- The minimum required [PHP](https://www.php.net/) version is PHP `7.4`.
- It works best with PHP `8`.

The preferred way to install this extension is through [composer](https://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist yiisoft/yii2-collection

```

or add

```
"yiisoft/yii2-collection": "~1.0.0"
```

to the require section of your composer.json.

Configuration
-------------

[](#configuration)

To use this extension, you have to attach the `yii\collection\CollectionBehavior` to the `ActiveQuery` instance of your `ActiveRecord` classes by overriding the `find()` method:

```
/**
 * {@inheritdoc}
 * @return \yii\db\ActiveQuery|\yii\collection\CollectionBehavior
 */
public static function find()
{
    $query = parent::find();
    $query->attachBehavior('collection', \yii\collection\CollectionBehavior::class);
    return $query;
}
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance52

Moderate activity, may be stable

Popularity35

Limited adoption so far

Community28

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor3

3 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/261a6249c6f605f3956a2fae40fbb813f6b2e1e6f2bf806180c851a965426e54?d=identicon)[cebe](/maintainers/cebe)

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

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

![](https://www.gravatar.com/avatar/854af1889dd7384243cff0bf0fde23463f76058b499b15c740f02e7033ec7ce6?d=identicon)[klimov-paul](/maintainers/klimov-paul)

---

Top Contributors

[![klimov-paul](https://avatars.githubusercontent.com/u/1482054?v=4)](https://github.com/klimov-paul "klimov-paul (9 commits)")[![cebe](https://avatars.githubusercontent.com/u/189796?v=4)](https://github.com/cebe "cebe (7 commits)")[![Arhell](https://avatars.githubusercontent.com/u/26163841?v=4)](https://github.com/Arhell "Arhell (5 commits)")[![bizley](https://avatars.githubusercontent.com/u/8577314?v=4)](https://github.com/bizley "bizley (3 commits)")[![samdark](https://avatars.githubusercontent.com/u/47294?v=4)](https://github.com/samdark "samdark (3 commits)")[![rustamwin](https://avatars.githubusercontent.com/u/16498265?v=4)](https://github.com/rustamwin "rustamwin (2 commits)")[![s1lver](https://avatars.githubusercontent.com/u/4567634?v=4)](https://github.com/s1lver "s1lver (2 commits)")[![softark](https://avatars.githubusercontent.com/u/342857?v=4)](https://github.com/softark "softark (2 commits)")[![KartaviK](https://avatars.githubusercontent.com/u/5941637?v=4)](https://github.com/KartaviK "KartaviK (1 commits)")[![WinterSilence](https://avatars.githubusercontent.com/u/3521094?v=4)](https://github.com/WinterSilence "WinterSilence (1 commits)")[![machour](https://avatars.githubusercontent.com/u/304450?v=4)](https://github.com/machour "machour (1 commits)")[![vanodevium](https://avatars.githubusercontent.com/u/16780069?v=4)](https://github.com/vanodevium "vanodevium (1 commits)")

---

Tags

collectionyii2yii2-extension

### Embed Badge

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

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

###  Alternatives

[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

712181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)[laravel/pail

Easily delve into your Laravel application's log files directly from the command line.

91545.3M590](/packages/laravel-pail)

PHPackages © 2026

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