PHPackages                             eclou/yii2-closure-table - 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. [Database &amp; ORM](/categories/database)
4. /
5. eclou/yii2-closure-table

ActiveYii2-extension[Database &amp; ORM](/categories/database)

eclou/yii2-closure-table
========================

the closure table behavior for yii2

v1.0.3(8mo ago)0321PHP

Since Oct 31Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/eclou/yii2-closure-table)[ Packagist](https://packagist.org/packages/eclou/yii2-closure-table)[ RSS](/packages/eclou-yii2-closure-table/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

yii2-closure-table
==================

[](#yii2-closure-table)

#### Configure

[](#configure)

configure query model:

```
class ClosureQuery extends ActiveQuery
{
    public function behaviors()
    {
        return [
            ClosureTableQueryBehavior::class
        ];
    }
}
```

configure active model:

```
class ClosureTable extends ActiveRecord
{
    public function behaviors()
    {
        return [
            [
                'class' => ClosureTableBehavior::class,
                'closureTable' => ClosureTableTree::class, //closure table defined model
                'parentAttribute' => 'parent',
                'childAttribute' => 'child',
                'depthAttribute' => 'depth'
            ]
        ];
    }

    public static function find()
    {
        return new ClosureQuery(static::class);
    }
}

class ClosureTableTree extends ActiveRecord
{
    public static function tableName()
    {
        return 'closure_table_tree';
    }

    public function rules()
    {
        return [
            [['parent','child','depth'],'integer']
        ];
    }
}
```

#### Usage

[](#usage)

```
ClosureTable::findOne(['_id' => 1])->parents()->all()

$node1 = new ClosureTable();
$node1->saveAsRoot();

$node2 = new ClosureTable();
$node2->appenTo($node1);
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance59

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

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

Total

4

Last Release

258d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/946db1719c8807e50660291805cdb188a80ba421f2eca06ba19433c03e4e6e41?d=identicon)[eclou](/maintainers/eclou)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/eclou-yii2-closure-table/health.svg)

```
[![Health](https://phpackages.com/badges/eclou-yii2-closure-table/health.svg)](https://phpackages.com/packages/eclou-yii2-closure-table)
```

###  Alternatives

[yii2tech/illuminate

Yii2 to Laravel Migration Package

11315.1k](/packages/yii2tech-illuminate)[mootensai/yii2-relation-trait

Yii 2 Models load with relation, &amp; transaction save with relation

47220.3k9](/packages/mootensai-yii2-relation-trait)[nhkey/yii2-activerecord-history

Storage history of changes to ActiveRecord

46143.4k1](/packages/nhkey-yii2-activerecord-history)[dmstr/yii2-db

Database extensions

19618.8k6](/packages/dmstr-yii2-db)[urbanindo/yii2-dynamodb

DynamoDB extensions for Yii2

1471.4k](/packages/urbanindo-yii2-dynamodb)[spanjeta/yii2-backup

Database Backup and Restore functionality

285.0k1](/packages/spanjeta-yii2-backup)

PHPackages © 2026

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