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(10mo ago)0321PHP

Since Oct 31Pushed 10mo 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 today

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

30

—

LowBetter than 62% of packages

Maintenance54

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

310d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13130465?v=4)[eclou](/maintainers/eclou)[@eclou](https://github.com/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

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[bizley/migration

Migration generator for Yii 2.

296389.5k11](/packages/bizley-migration)[yii2tech/illuminate

Yii2 to Laravel Migration Package

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

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

49232.7k9](/packages/mootensai-yii2-relation-trait)

PHPackages © 2026

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