PHPackages                             koperdog/yii2-treeview - 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. koperdog/yii2-treeview

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

koperdog/yii2-treeview
======================

Widget to display the ns tree as a grid

1.0.1(6y ago)25061[1 issues](https://github.com/koperdog/yii2-treeview/issues)Apache-2.0PHPPHP &gt;=7.0.0

Since Dec 11Pushed 6y ago1 watchersCompare

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

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

TreeView widget
===============

[](#treeview-widget)

Widget to display the nested sets tree as a grid

Based on [GridView](https://www.yiiframework.com/doc/api/2.0/yii-grid-gridview)

[![Packagist](https://camo.githubusercontent.com/26b5a0b05b79e4b3d8afaf6156f122f23561a1486db87fc8e0da900e791c9663/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b6f706572646f672f796969322d7472656576696577)](https://camo.githubusercontent.com/26b5a0b05b79e4b3d8afaf6156f122f23561a1486db87fc8e0da900e791c9663/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b6f706572646f672f796969322d7472656576696577) [![Packagist Version](https://camo.githubusercontent.com/13863f51199be6833936b9f89000c74a7dc26784189a776f196c78043f2f2b81/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b6f706572646f672f796969322d7472656576696577)](https://camo.githubusercontent.com/13863f51199be6833936b9f89000c74a7dc26784189a776f196c78043f2f2b81/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b6f706572646f672f796969322d7472656576696577) [![PHP from Packagist](https://camo.githubusercontent.com/7f8fa4ceeb127979c463b5f1439f734c8fcd5d4adb006fb832af89085fd1c3b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6b6f706572646f672f796969322d7472656576696577)](https://camo.githubusercontent.com/7f8fa4ceeb127979c463b5f1439f734c8fcd5d4adb006fb832af89085fd1c3b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6b6f706572646f672f796969322d7472656576696577)

[![preview](https://user-images.githubusercontent.com/15054192/70629631-1d20c300-1c4c-11ea-854b-19aaa64137fb.png)](https://user-images.githubusercontent.com/15054192/70629631-1d20c300-1c4c-11ea-854b-19aaa64137fb.png)

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist koperdog/yii2-treeview "*"

```

or add

```
"koperdog/yii2-treeview": "*"

```

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

Usage
-----

[](#usage)

Add to your model field:

```
public $children = null;
```

### Has the same settings as GridView.

[](#has-the-same-settings-as-gridview)

```
echo koperdog\yii2treeview\TreeView::widget([
	'dataProvider'  => $dataProvider,
	//'depthPrefix' => ' — ', //see Additional options
	//'depthRoot'   => 1, //see Additional options
	//'collaplse'   => true, //see Additional options
	'columns' => [
	  'id',
	  'name',
	  'created_at:datetime',
	  // ...
	],
    ]);
```

### The column classes the same as GridView

[](#the-column-classes-the-same-as-gridview)

```
['class' => '\koperdog\yii2treeview\base\CheckboxColumn'],
['class' => '\koperdog\yii2treeview\base\ActionColumn'],
['class' => '\koperdog\yii2treeview\base\RadioButtonColumn'],
['class' => '\koperdog\yii2treeview\base\SerialColumn'],
```

 Additional options##### depthPrefix - Prefix that displays depth (default " — ")

[](#depthprefix---prefix-that-displays-depth-default---)

##### depthRoot - Offset from the root (default 0)

[](#depthroot---offset-from-the-root-default-0)

##### collaplse - if true, it will add the class "closed" to the node elements, and "tree-collapse" to the root of the tree (default false)

[](#collaplse---if-true-it-will-add-the-class-closed-to-the-node-elements-and-tree-collapse-to-the-root-of-the-tree-default-false)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

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

Every ~55 days

Total

2

Last Release

2287d ago

### Community

Maintainers

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

---

Top Contributors

[![evgenii-ch97](https://avatars.githubusercontent.com/u/80455757?v=4)](https://github.com/evgenii-ch97 "evgenii-ch97 (12 commits)")

---

Tags

yii2treeview grid view tree

### Embed Badge

![Health badge](/badges/koperdog-yii2-treeview/health.svg)

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

###  Alternatives

[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

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

PHPackages © 2026

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