PHPackages                             mazurva/yii2-nestable2 - 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. [Framework](/categories/framework)
4. /
5. mazurva/yii2-nestable2

ActiveYii2-extension[Framework](/categories/framework)

mazurva/yii2-nestable2
======================

Yii 2.0 implementation of nested set behavior using nestable2 plugin.

v1.0(4y ago)148BSD-3-ClauseJavaScript

Since Nov 10Pushed 2y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (2)Used By (0)

yii2-nestable2
==============

[](#yii2-nestable2)

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

- jquery.nestable plugin:
- Nested Sets Behavior for Yii 2:

[![tree](https://user-images.githubusercontent.com/1152567/152440593-2d69b582-264d-4e90-97e7-a642fff01b3b.jpg)](https://user-images.githubusercontent.com/1152567/152440593-2d69b582-264d-4e90-97e7-a642fff01b3b.jpg)

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

[](#installation)

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

Either run

```
$ php composer.phar require mazurva/yii2-nestable2 "dev-master"

```

or add

```
"mazurva/yii2-nestable2": "dev-master"

```

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

Usage
-----

[](#usage)

Make sure you've attached the NestedSetsBehavior (creocoder/yii2-nested-sets) correctly to your model. Then add the node move handler to you controller by attaching the supplied action;

```
use mazurva\nestable2\widgets\Nestable;

class yourClass extends Controller
{
    public function actions() {
        return [
            'nodeMove' => [
                'class' => 'mazurva\nestable2\actions\NodeMoveAction',
                'modelName' => TreeModel::className(),
            ],
        ];
    }

```

And then render the widget in your view;

```
echo Nestable::widget([
    'type' => Nestable::TYPE_WITH_HANDLE,
    'query' => TreeModel::find()->where([ top of tree ]),
    'modelOptions' => [
        'name' => 'name'
    ],
    'pluginEvents' => [
        'change' => 'function(e) {}',
    ],
    'pluginOptions' => [
        'maxDepth' => 7,
    ],
]);

```

You can either supply an ActiveQuery object in `query` from which a tree will be built. You can also supply an item list;

```
    ...
    'items' => [
        ['content' => 'Item # 1', 'id' => 1],
        ['content' => 'Item # 2', 'id' => 2],
        ['content' => 'Item # 3', 'id' => 3],
        ['content' => 'Item # 4 with children', 'id' => 4, 'children' => [
            ['content' => 'Item # 4.1', 'id' => 5],
            ['content' => 'Item # 4.2', 'id' => 6],
            ['content' => 'Item # 4.3', 'id' => 7],
        ]],
    ],

```

The `modelOptions['name']` should hold an attribute name that will be used to name on the items in the list. You can alternatively supply an unnamed `function($model)` to build your own content string.

Supply a `pluginEvents['change']` with some JavaScript code to catch the change event fired by jquery.nestable plugin. The `pluginOptions` accepts all the options for the original jquery.nestable plugin.

###  Health Score

23

—

LowBetter than 30% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

1595d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6efd9689c925cb52664846422950fa2ffe7cd9c44b9644eda8479499c104076?d=identicon)[mazurva](/maintainers/mazurva)

---

Top Contributors

[![mazurva](https://avatars.githubusercontent.com/u/1152567?v=4)](https://github.com/mazurva "mazurva (9 commits)")

---

Tags

jquerysortableyii2extensionBehaviorwidgetnestablenested-set

### Embed Badge

![Health badge](/badges/mazurva-yii2-nestable2/health.svg)

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

###  Alternatives

[slatiusa/yii2-nestable

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

1718.0k2](/packages/slatiusa-yii2-nestable)[kartik-v/yii2-sortable

Create sortable lists and grids using HTML5 drag and drop API for Yii 2.0.

433.8M13](/packages/kartik-v-yii2-sortable)[kartik-v/yii2-widget-fileinput

An enhanced FileInput widget for Bootstrap 3.x, 4.x &amp; 5.x with file preview, multiple selection, and more features (sub repo split from yii2-widgets)

2356.7M93](/packages/kartik-v-yii2-widget-fileinput)[kartik-v/yii2-dynagrid

Turbo charge the Yii 2 GridView with personalized columns, page size, and themes.

813.0M26](/packages/kartik-v-yii2-dynagrid)[miloschuman/yii2-highcharts-widget

Highcharts widget for Yii 2 Framework.

1641.5M14](/packages/miloschuman-yii2-highcharts-widget)[kartik-v/yii2-widget-colorinput

An enhanced Yii 2 widget encapsulating the HTML 5 color input (sub repo split from yii2-widgets)

324.8M8](/packages/kartik-v-yii2-widget-colorinput)

PHPackages © 2026

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