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

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

nbczw8750/tree
==============

无限级树结构生成

v1.0(8y ago)027mitPHP

Since Sep 30Pushed 8y ago1 watchersCompare

[ Source](https://github.com/nbczw8750/tree)[ Packagist](https://packagist.org/packages/nbczw8750/tree)[ RSS](/packages/nbczw8750-tree/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

![Github All Releases](https://camo.githubusercontent.com/fb6b72b6de89cea4093dcf8fc49bec3c00fd31a86b40232e50bad4d15fefc936/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344352e342d677265656e2e737667)php递归无限级树形数据
===============================================================================================================================================================================================================================================================

[](#php递归无限级树形数据)

使用使用方法
------

[](#使用使用方法)

#### 设置主键、parent标识名称 字节点名称

[](#设置主键parent标识名称-字节点名称)

```
$tree = new \nbczw8750\tree\DeepTree();
$tree->setConfig($primary = '', $parentId = '', $child = '');
```

#### 生成tree data

[](#生成tree-data)

```
$data = $tree->makeTree($data);
```

运行结果

```
print_r($data);
Array
(
    [0] = Array
   (
      [id] = 1
       [city] = 中国
       [parent_id] = 0
        [child] = Array
         (
                 [0] = Array
                      (
                             [id] = 2
                            [city] = 北京
                             [parent_id] = 1
                             [child] = Array
                                (
                                 [0] = Array
                                         (
                                             [id] = 3
                                            [city] = 北京市
                                            [parent_id] = 2
                                            [child] = Array
                                                (
                                                   [0] = Array
                                                       (
                                                            [id] = 4
                                                            [city] = 东城区
                                                            [parent_id] = 3
                                                        )

                                                )

                                        )

                                )

                        )

                    [1] = Array
                        (
                            [id] = 11
                            [city] = 上海
                            [parent_id] = 1
                            [child] = Array
                                (
                                    [0] = Array
                                        (
                                            [id] = 12
                                            [city] = 上海市
                                            [parent_id] = 11
                                        )

                                )

                        )

                )

        )

)
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

3148d ago

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[jaeger/querylist

Simple, elegant, extensible PHP Web Scraper (crawler/spider),Use the css3 dom selector,Based on phpQuery! 简洁、优雅、可扩展的PHP采集工具(爬虫)，基于phpQuery。

2.7k641.7k86](/packages/jaeger-querylist)[smile/module-store-locator

Smile Store Locator

51516.6k4](/packages/smile-module-store-locator)[gpslab/base64uid

Generate UID like YouTube

68103.4k](/packages/gpslab-base64uid)[mage-os/module-page-builder-template-import-export

PageBuilder template import/export module

185.5k](/packages/mage-os-module-page-builder-template-import-export)

PHPackages © 2026

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