PHPackages                             quanzo/yii2-tree - 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. quanzo/yii2-tree

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

quanzo/yii2-tree
================

Ajax tree mapping. Adjacency list tree type. The ability to change the structure.

1.0.0(6y ago)01MITPHPPHP &gt;=7.0

Since Sep 5Pushed 6y ago1 watchersCompare

[ Source](https://github.com/quanzo/yii2-tree)[ Packagist](https://packagist.org/packages/quanzo/yii2-tree)[ RSS](/packages/quanzo-yii2-tree/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Ajax output Adjacency List tree - module for Yii2
=================================================

[](#ajax-output-adjacency-list-tree---module-for-yii2)

Install
-------

[](#install)

Install via Composer:

```
composer require quanzo/yii2-tree
```

or add

```
"quanzo/yii2-tree" : "*"
```

to the `require` section of your `composer.json` file.

Config
------

[](#config)

```
$config = [
...
    'modules' => [
...
        'tree' => [
            'class' => 'x51\yii2\modules\tree\Module',
            'tree' => [ // tree configs
                'category' => [
                    'tableName' => '{{%category}}',
                    'keyField' => 'id',
                    'parentField' => 'post_parent',
                    'nameField' => 'post_name',
                ],
                'articles' => [
                    'module' => 'articles',
                    //'where' => ['post_type'=>'category'],
                    'name' => function ($arItem) {
                        return '[' . $arItem['post_type'] . '] ' . $arItem['post_title'];
                    },
                ],
                'category' => [
                    'module' => 'articles',
                    'where' => ['post_type' => 'category'],
                ],
            ],
        ],
        // another definition
        'rubricator' => [
            'class' => '\x51\yii2\modules\tree\Module',
            'itemTemplate' => '⊕{name}{subitems}',
            'params' => [ // Extra options. see itemTemplate
                'url' => function ($cfg, $item) {
                    if (!empty($cfg['module'])) {
                        return yii\helpers\Url::to(['/articles/post/view', 'id' => $item['id']]);
                    } else {
                        return '##';
                    }
                },
            ],
            'tree' => [
                'articles' => [
                    'module' => 'articles',
                    'where' => ['post_type' => 'category'],
                    'urlDelete' => false,
                    'urlMove' => false,
                    'allowSelect' => false,
                    'activeID' => function ($cfg) {
                        if (!empty($_GET['id'])) {
                            return intval($_GET['id']);
                        }
                        return false;
                    },
                ],
            ],
        ],
...
    ],
...
];
```

Using
-----

[](#using)

```
echo \Yii::$app->getModule('tree')->widget('category');
// or
echo \Yii::$app->getModule('tree')->widget('category', $arAdvParams);
/* reassign parameters
$arAdvParams = [
    ...
    'urlDelete' => false,
    'urlMove' => false,
    'urlBranch' => false,
    ...
];
*/
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

2441d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10706162?v=4)[quanzo](/maintainers/quanzo)[@quanzo](https://github.com/quanzo)

---

Top Contributors

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

---

Tags

treeyii2adjacency listyii2 moduleadjacency list tree

### Embed Badge

![Health badge](/badges/quanzo-yii2-tree/health.svg)

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

###  Alternatives

[paulzi/yii2-adjacency-list

Adjacency List Behavior for Yii2

68237.4k16](/packages/paulzi-yii2-adjacency-list)[paulzi/yii2-auto-tree

Allow apply multiple tree behavior for ActiveRecord in Yii2

5053.8k6](/packages/paulzi-yii2-auto-tree)[gilek/yii2-gtreetable

yii2-gtreetable is an extension of Yii 2 Framework, which is wrapper for bootstrap-gtreetable plug-in, on the other hand it provides functionality which allows to save the nodes states into database.

4111.8k](/packages/gilek-yii2-gtreetable)

PHPackages © 2026

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