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

ActiveLibrary

jiangzg/composer-tree
=====================

hahha

1.0.0(8y ago)2271MTKPHPPHP &gt;=5.3

Since Aug 17Pushed 8y ago1 watchersCompare

[ Source](https://github.com/jiangzhenggeng/composer_tree)[ Packagist](https://packagist.org/packages/jiangzg/composer-tree)[ RSS](/packages/jiangzg-composer-tree/feed)WikiDiscussions master Synced 2mo ago

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

composer-tree：php不使用递归调用将数组树形化高效代码
==================================

[](#composer-treephp不使用递归调用将数组树形化高效代码)

使用方法
----

[](#使用方法)

\#安装 composer require jiangzg/composer-tree:1.0.0

```
include_once __DIR__.'/../vendor/autoload.php';

$testAyy = [
    [
        'id'=>1,
        'parentid'=>0,
        'name'=>'第1个'
    ],
    [
        'id'=>2,
        'parentid'=>1,
        'name'=>'第2个'
    ],
    [
        'id'=>3,
        'parentid'=>2,
        'name'=>'第3个'
    ],
    [
        'id'=>4,
        'parentid'=>1,
        'name'=>'第4个'
    ],
    [
        'id'=>5,
        'parentid'=>0,
        'name'=>'第5个'
    ],
    [
        'id'=>6,
        'parentid'=>5,
        'name'=>'第6个'
    ],
    [
        'id'=>7,
        'parentid'=>6,
        'name'=>'第7个'
    ],
    [
        'id'=>8,
        'parentid'=>5,
        'name'=>'第8个'
    ],
    [
        'id'=>9,
        'parentid'=>8,
        'name'=>'第9个'
    ],
    [
        'id'=>10,
        'parentid'=>9,
        'name'=>'第10个'
    ],
];

$tree = new \JiangZG\Tree\Tree();

$result = $tree->createTree($testAyy);

print_r($result);
```

输出结果
----

[](#输出结果)

```
Array
(
    [0] => Array
        (
            [id] => 1
            [parentid] => 0
            [name] => 第1个
            [children] => Array
                (
                    [0] => Array
                        (
                            [id] => 2
                            [parentid] => 1
                            [name] => 第2个
                            [children] => Array
                                (
                                    [0] => Array
                                        (
                                            [id] => 3
                                            [parentid] => 2
                                            [name] => 第3个
                                        )

                                )

                        )

                    [1] => Array
                        (
                            [id] => 4
                            [parentid] => 1
                            [name] => 第4个
                        )

                )

        )

    [1] => Array
        (
            [id] => 5
            [parentid] => 0
            [name] => 第5个
            [children] => Array
                (
                    [0] => Array
                        (
                            [id] => 6
                            [parentid] => 5
                            [name] => 第6个
                            [children] => Array
                                (
                                    [0] => Array
                                        (
                                            [id] => 7
                                            [parentid] => 6
                                            [name] => 第7个
                                        )

                                )

                        )

                    [1] => Array
                        (
                            [id] => 8
                            [parentid] => 5
                            [name] => 第8个
                            [children] => Array
                                (
                                    [0] => Array
                                        (
                                            [id] => 9
                                            [parentid] => 8
                                            [name] => 第9个
                                            [children] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [id] => 10
                                                            [parentid] => 9
                                                            [name] => 第10个
                                                        )

                                                )

                                        )

                                )

                        )

                )

        )

)
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

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

3188d ago

### Community

Maintainers

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

---

Top Contributors

[![jiangzhenggeng](https://avatars.githubusercontent.com/u/18651984?v=4)](https://github.com/jiangzhenggeng "jiangzhenggeng (11 commits)")

### Embed Badge

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

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

PHPackages © 2026

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