PHPackages                             rezident/yii2-nested-set-plus - 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. rezident/yii2-nested-set-plus

ActiveYii2-extension

rezident/yii2-nested-set-plus
=============================

This extension allows you to get functional for nested set trees and widget for show and manipulate nested data in view.

v0.2.6(10y ago)012BSD-3-ClausePHP

Since Jan 28Pushed 10y agoCompare

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

READMEChangelogDependencies (1)Versions (7)Used By (0)

Nested Set behavior and Nested Draggable List widget for Yii 2
==============================================================

[](#nested-set-behavior-and-nested-draggable-list-widget-for-yii-2)

This extension is a fork of [wbraganca/yii2-nested-set-behavior](https://github.com/wbraganca/yii2-nested-set-behavior).

It is developed for use in our internal project, but you can use and/or modify it on your own.

Just like [Nested Set behavior by wbraganca](https://github.com/wbraganca/yii2-nested-set-behavior), this extension allows you to get functional for nested set trees and also includes a widget for show Drag &amp; drop hierarchical list with mouse and touch compatibility based on [dbushell/Nestable](https://github.com/dbushell/Nestable) jQuery plugin.

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

[](#installation)

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

Either run

```
php composer.phar require rezident/yii2-nested-set-plus "*"
```

or add

```
"rezident/yii2-nested-set-plus": "*"
```

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

Configuring
-----------

[](#configuring)

First you need to configure model as follows:

```
use kgladkiy\behaviors\NestedSetBehavior;
use kgladkiy\behaviors\NestedSetQuery;

class Category extends ActiveRecord
{
    public function behaviors()
    {
        return [
            [
                'class' => NestedSetBehavior::className(),
                // 'rootAttribute' => 'root',
                // 'levelAttribute' => 'level',
                // 'hasManyRoots' => true
            ],
        ];
    }

    public static function find()
    {
        return new NestedSetQuery(get_called_class());
    }
}
```

There is no need to validate fields specified in `leftAttribute`, `rightAttribute`, `rootAttribute` and `levelAttribute` options. Moreover, there could be problems if there are validation rules for these. Please check if there are no rules for fields mentioned in model's rules() method.

In case of storing a single tree per database, DB structure can be built with `schema/schema.sql`. If you're going to store multiple trees you'll need `schema/schema-many-roots.sql`.

By default `leftAttribute`, `rightAttribute` and `levelAttribute` values are matching field names in default DB schemas so you can skip configuring these.

There are two ways this behavior can work: one tree per table and multiple trees per table. The mode is selected based on the value of `hasManyRoots` option that is `false` by default meaning single tree mode. In multiple trees mode you can set `rootAttribute` option to match existing field in the table storing the tree.

Work with Nested Set behavior
-----------------------------

[](#work-with-nested-set-behavior)

Please read the [original plugin documentation](https://github.com/wbraganca/yii2-nested-set-behavior#selecting-from-a-tree)for get an information about work with the nested data.

Note that method for fetch and prepare data for use with Fancytree was removed from `NestedSetQueryBehavior` class.

Instead of was added method `NestedSetQueryBehavior::tree()` that returns tree data for Nested Draggable List widget.

Using Nested Draggable List widget
----------------------------------

[](#using-nested-draggable-list-widget)

```
use kgladkiy\widgets\NestedList;

echo NestedList::widget([
    'items' => $treeData, // $treeData = Category::find()->tree();
    'actions' => true, // set to false for disable 'edit' and 'delete' buttons
]);
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

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

Recently: every ~108 days

Total

6

Last Release

3673d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/35a3eb31f74a417ee93f44961f6e1c43b95821ddb977d6310f289f2da14724f8?d=identicon)[rezident](/maintainers/rezident)

---

Top Contributors

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

---

Tags

yii2extensionnested-setyii2 widgetyii2-behavior

### Embed Badge

![Health badge](/badges/rezident-yii2-nested-set-plus/health.svg)

```
[![Health](https://phpackages.com/badges/rezident-yii2-nested-set-plus/health.svg)](https://phpackages.com/packages/rezident-yii2-nested-set-plus)
```

###  Alternatives

[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13825.6k46](/packages/skeeks-cms)[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)[slatiusa/yii2-nestable

Yii 2.0 implementation of nested set behavior using jquery.nestable plugin.

1918.1k2](/packages/slatiusa-yii2-nestable)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

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