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

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

arogachev/yii2-tree
===================

Database tree structures management for Yii 2 framework

0.1.0(11y ago)222.1k↓91%10[9 issues](https://github.com/arogachev/yii2-tree/issues)[2 PRs](https://github.com/arogachev/yii2-tree/pulls)BSD-3-ClausePHP

Since Jun 13Pushed 9y ago1 watchersCompare

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

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

Yii 2 Tree
==========

[](#yii-2-tree)

Database tree structures management for Yii 2 framework

[![Latest Stable Version](https://camo.githubusercontent.com/faa5d1da23ea2f7b4a7092387bc8e968dcea3f2d7bccf5848e7976d6ec9ecb42/68747470733a2f2f706f7365722e707567782e6f72672f61726f6761636865762f796969322d747265652f762f737461626c65)](https://packagist.org/packages/arogachev/yii2-tree)[![Total Downloads](https://camo.githubusercontent.com/e87a769fdde4c35c0ec197bd251f6cff68fbcd0cec41eb9eaecb3b11d7f96f3c/68747470733a2f2f706f7365722e707567782e6f72672f61726f6761636865762f796969322d747265652f646f776e6c6f616473)](https://packagist.org/packages/arogachev/yii2-tree)[![Latest Unstable Version](https://camo.githubusercontent.com/4c379293a628f0adafc580e7683f414cae6dd2b458bb208599542935b9bf495c/68747470733a2f2f706f7365722e707567782e6f72672f61726f6761636865762f796969322d747265652f762f756e737461626c65)](https://packagist.org/packages/arogachev/yii2-tree)[![License](https://camo.githubusercontent.com/4c44f0e9edbfed3708ffc6ec842d51f492ad895d1b01913b98572d78fb8d0523/68747470733a2f2f706f7365722e707567782e6f72672f61726f6761636865762f796969322d747265652f6c6963656e7365)](https://packagist.org/packages/arogachev/yii2-tree)

Currently it's Nested Sets management extension based on:

- [Yii2 Nested Sets](https://github.com/creocoder/yii2-nested-sets)
- [jsTree](https://github.com/vakata/jstree)

Contents:

- [Installation](#installation)
- [Features](#features)
- [Usage](#usage)
- [Behavior configuration](#behavior-configuration)
- [Widget configuration](#widget-configuration)

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist arogachev/yii2-tree

```

or add

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

```

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

Features
--------

[](#features)

- Basic actions with tree nodes: creating, renaming, moving, deleting
- Saving state of nodes (opened / closed)
- Links for updating node

Usage
-----

[](#usage)

Add this to application config:

```
'controllerMap' => [
    'tree' => 'arogachev\tree\controllers\TreeController',
],
```

Attach additional behavior along with `NestedSetsBehavior` to your model:

```
use arogachev\tree\behaviors\NestedSetsManagementBehavior;
```

```
/**
 * @inheritdoc
 */
public function behaviors()
{
    return [
        NestedSetsBehavior::className(),
        NestedSetsManagementBehavior::className(),
    ];
}
```

The last step is display widget:

```
use arogachev\tree\widgets\NestedSets;
use frontend\modules\department\models\Department;
```

```

```

Behavior configuration
----------------------

[](#behavior-configuration)

`nameAttribute` - string, the name of attribute storing the name of node. Defaults to `name`.

`saveState` - boolean, save state of nodes (opened / closed). Defaults to `false`.

`isOpenedAttribute` - string, the name of attribute storing if the node opened or closed. Used together with `saveState`. Defaults to `is_opened`.

Widget configuration
--------------------

[](#widget-configuration)

`modelClass` - string, the full model class including namespace of managed model. Required.

`updateUrl` - string, url for updating model in separate page. Will be processed by `yii\helpers\Url::to()`.

`jsTreeOptions` - array, options for JsTree widget. Example:

```
'jsTreeOptions' => [
    'clientOptions' => [
        'core' => [
            'strings' => [
                'New node' => 'Новый отдел',
            ],
        ],
    ],
],
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community11

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

4039d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1714d1321ae502a7f9bfd21e9a4cb7467306491280fa8b5d43d549434abd5177?d=identicon)[arogachev](/maintainers/arogachev)

---

Top Contributors

[![arogachev](https://avatars.githubusercontent.com/u/8326201?v=4)](https://github.com/arogachev "arogachev (17 commits)")

---

Tags

treeyii2active-recordwidgetnested setsnested-set

### Embed Badge

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

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[voskobovich/yii2-linker-behavior

This behavior makes it easy to maintain many-to-many and one-to-many relations in your ActiveRecord models.

80336.2k9](/packages/voskobovich-yii2-linker-behavior)[devgroup/yii2-jstree-widget

jsTree widget for yii2

2323.7k](/packages/devgroup-yii2-jstree-widget)[sjaakp/yii2-sortable-behavior

Sort ActiveRecords and related records in Yii2.

36169.5k](/packages/sjaakp-yii2-sortable-behavior)[edgardmessias/yii2-firebird

Firebird connector for Yii2 framework

2415.8k1](/packages/edgardmessias-yii2-firebird)

PHPackages © 2026

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