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

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

brill-tree/brill-tree
=====================

php对关系型数据转换成树状图

v1.0(7y ago)19MITPHP

Since Feb 12Pushed 7y agoCompare

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

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

### PHP系统树图

[](#php系统树图)

[![v1.0](https://camo.githubusercontent.com/fc9ae07b6858ce7de7db4b9c2432284cb60ce861e4dfbe073ec515adbed15f73/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f64656e64726f6772616d2d76312e302d6f72616e67652e737667)](https://github.com/ShawnPuth/brillTree)[![laravel 5.*](https://camo.githubusercontent.com/1fd500f613af2390dd5d83eda79c8620ded2fe3abab69fd9c737680d5f585fd8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d352e2a2d79656c6c6f772e737667)](https://github.com/ShawnPuth/brillTree)[![PHP>=5.6](https://camo.githubusercontent.com/03d4a63e22b4d0a0d86012343fcb372aa36efce708fd04061d0e720e652423be/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344352e362d626c75652e737667)](https://github.com/ShawnPuth/brillTree)

brillTreeLaravelPHPv1.05.\*&gt;=5.6.4### 安装

[](#安装)

```
composer require brill-tree/brill-tree

```

### 配置

[](#配置)

首先往Laravel应用中注册ServiceProvider，打开文件config/app.php，在providers中添加一项：

```
'providers' => [
    DenDroGram\DendrogramServiceProvider::class
]

```

然后发布拓展包的配置文件，使用如下命令：

```
php artisan vendor:publish

```

此时config目录下会生成dendrogram.php配置文件

[![config](https://github.com/ydtg1993/dendrogram/raw/master/image/config.PNG)](https://github.com/ydtg1993/dendrogram/blob/master/image/config.PNG)

### 数据导入（两表三个自定义函数 表结构可自行添加字段）

[](#数据导入两表三个自定义函数-表结构可自行添加字段)

```
php artisan migrate

```

adjacency结构 以父节点为基准的链式查询 增删容易 查询不便

[![config](https://github.com/ydtg1993/dendrogram/raw/master/image/adjacency.PNG)](https://github.com/ydtg1993/dendrogram/blob/master/image/adjacency.PNG)

nested结构 以左右值包容形式 增删不便 查询容易

[![config](https://github.com/ydtg1993/dendrogram/raw/master/image/nested.PNG)](https://github.com/ydtg1993/dendrogram/blob/master/image/nested.PNG)

### 方法说明

[](#方法说明)

   调用 构造参数 方法说明 方法参数 返回 备注     (new DenDroGram(AdjacencyList::class))-&gt;buildTree($node\_id,\['name'\]) adjacency数据格式 adjacency格式数据生成目录式结构树 根节点id , 每个节点显示信息 返回html文本string 视图的相关在dendrogram.php中配置 如操作节点方法的路由   (new DenDroGram(AdjacencyList::class))-&gt;operateNode($action,$data) adjacency数据格式 adjacency格式数据的节点操作 action增删改标识 , data节点详情数据 返回boolean 注意视图与之对应的数据结构AdjacencyList::class   (new DenDroGram(AdjacencyList::class))-&gt;getTreeData($node\_id); adjacency数据格式 adjacency数据构造成多维数组 根节点id 返回array 多维数组结构   (new DenDroGram(NestedSet::class))-&gt;buildTree($node\_id,\['name'\]) NestedSet数据格式 NestedSet格式数据生成根茎式结构树 根节点id , 每个节点显示信息 返回html文本string 视图的相关在dendrogram.php中配置 如操作节点方法的路由   (new DenDroGram(NestedSet::class))-&gt;operateNode($action,$data) NestedSet数据格式 NestedSet格式数据的节点操作 action增删改标识 , data节点详情数据 返回boolean 注意视图与之对应的数据结构NestedSet::class   (new DenDroGram(NestedSet::class))-&gt;getTreeData($node\_id); NestedSet数据格式 NestedSet数据构造成多维数组 根节点id 返回array 多维数组结构  ### 举个栗子

[](#举个栗子)

[![example](https://github.com/ydtg1993/dendrogram/raw/master/image/example.PNG)](https://github.com/ydtg1993/dendrogram/blob/master/image/example.PNG)

adjacency数据结构生成的视图

[![example](https://github.com/ydtg1993/dendrogram/raw/master/image/catelog.PNG)](https://github.com/ydtg1993/dendrogram/blob/master/image/catelog.PNG)

nested数据结构生成的视图

[![example](https://github.com/ydtg1993/dendrogram/raw/master/image/rhizome.PNG)](https://github.com/ydtg1993/dendrogram/blob/master/image/rhizome.PNG)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

2643d ago

### Community

Maintainers

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

---

Top Contributors

[![ydtg1993](https://avatars.githubusercontent.com/u/22272107?v=4)](https://github.com/ydtg1993 "ydtg1993 (66 commits)")

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M683](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M157](/packages/orchestra-canvas)[kirschbaum-development/commentions

A package to allow you to create comments, tag users and more

12369.2k](/packages/kirschbaum-development-commentions)[glhd/special

1929.4k](/packages/glhd-special)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k1](/packages/bjuppa-laravel-blog)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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