PHPackages                             bulton-fr/dependency-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. bulton-fr/dependency-tree

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

bulton-fr/dependency-tree
=========================

Lib to generate a tree of dependencies with PHP

1.2.0(9y ago)022.2k↓50%[1 issues](https://github.com/bulton-fr/dependency-tree/issues)1LGPL-3.0-onlyPHPPHP ^5.6|^7.0|^8.0CI passing

Since Jun 19Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/bulton-fr/dependency-tree)[ Packagist](https://packagist.org/packages/bulton-fr/dependency-tree)[ Docs](https://github.com/bulton-fr/dependency-tree)[ RSS](/packages/bulton-fr-dependency-tree/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (5)Versions (7)Used By (1)

dependency-tree
===============

[](#dependency-tree)

Lib for generate a dependency tree.

[![PHP Versions](https://camo.githubusercontent.com/bba40a23ee231d9c387680da69bd7e3c2c971747565752f1bf306fd236133e7a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d352e36253230746f253230382e332d3737376262332e7376673f6c6f676f3d706870266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d353535353535)](https://github.com/bulton-fr/dependency-tree/actions)[![Unit Tests](https://camo.githubusercontent.com/6536356a8ccf714b5ec93da8791d21804e6889767715c04c4e055eba928ee099/68747470733a2f2f67682d6261646765732e62756c746f6e2e66722f62616467653f7265706f7369746f72793d62756c746f6e2d66722f646570656e64656e63792d74726565266272616e63683d6d617374657226776f726b666c6f773d4349266a6f623d74657374)](https://github.com/bulton-fr/dependency-tree/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/6d4e4f9f4f33265c2309c0001420797a817ed7e326cc944ae08e181ffa0dd03c/68747470733a2f2f636f6465636f762e696f2f6769746875622f62756c746f6e2d66722f646570656e64656e63792d747265652f67726170682f62616467652e737667)](https://codecov.io/github/bulton-fr/dependency-tree)[![PHPStan](https://camo.githubusercontent.com/c36cbb254ce7f3efdd4024df1fb261331571631f15ea0035b9bfce4f9a633989/68747470733a2f2f67682d6261646765732e62756c746f6e2e66722f62616467653f7265706f7369746f72793d62756c746f6e2d66722f646570656e64656e63792d74726565266272616e63683d6d617374657226776f726b666c6f773d4349266a6f623d7068707374616e)](https://github.com/bulton-fr/dependency-tree/actions/workflows/ci.yml)[![Code Style](https://camo.githubusercontent.com/3f76f1b55f53f08ec8fb2d010885bb9d2b7aa14a5f116f85e9dd1744bad11af8/68747470733a2f2f67682d6261646765732e62756c746f6e2e66722f62616467653f7265706f7369746f72793d62756c746f6e2d66722f646570656e64656e63792d74726565266272616e63683d6d617374657226776f726b666c6f773d4349266a6f623d7068706373)](https://github.com/bulton-fr/dependency-tree/actions/workflows/ci.yml)[![PHPMD](https://camo.githubusercontent.com/2b2a40222ff28e89c72ccd4fb5a061b82da2f2b03617809d651e2101318a0313/68747470733a2f2f67682d6261646765732e62756c746f6e2e66722f62616467653f7265706f7369746f72793d62756c746f6e2d66722f646570656e64656e63792d74726565266272616e63683d6d617374657226776f726b666c6f773d4349266a6f623d7068706d64)](https://github.com/bulton-fr/dependency-tree/actions/workflows/ci.yml)

[![Latest Stable Version](https://camo.githubusercontent.com/5c514778acd993ff4309b11d39df36451d5213974768b77e06b4014df53c4d1e/68747470733a2f2f706f7365722e707567782e6f72672f62756c746f6e2d66722f646570656e64656e63792d747265652f762f737461626c652e737667)](https://packagist.org/packages/bulton-fr/dependency-tree)[![Latest Unstable Version](https://camo.githubusercontent.com/f2a69aa90cebac6391dc61ed9365e6fd8b2dd717a12a267b90574453c576e845/68747470733a2f2f706f7365722e707567782e6f72672f62756c746f6e2d66722f646570656e64656e63792d747265652f762f756e737461626c652e737667)](https://packagist.org/packages/bulton-fr/dependency-tree)[![License](https://camo.githubusercontent.com/d3be11f2b7c443641f905126e272290968ba9b8d9fe3bfcf8168db5e6095323f/68747470733a2f2f706f7365722e707567782e6f72672f62756c746f6e2d66722f646570656e64656e63792d747265652f6c6963656e73652e737667)](https://packagist.org/packages/bulton-fr/dependency-tree)

The Principle is to have a tree who contains lines. For each lines, there is a tree who contains lines too.

The first lines is for the package which loaded at the same times. But, for the same line, its package may have dependencies between them. So each lines contain a tree where packages are sorted for have their dependencies of the same line loaded before them.

Install with composer
---------------------

[](#install-with-composer)

Download composer

```
$ curl -s https://getcomposer.org/installer | php

```

Add call-curl repository to you composer.json

```
{
    "require": {
        "bulton-fr/dependency-tree": "@stable"
    }
}
```

Execute the command

```
$ php composer.phar install

```

Use in your code
----------------

[](#use-in-your-code)

### Basic usage

[](#basic-usage)

```
$tree = new \bultonFr\DependencyTree\DependencyTree;
$tree->addDependency('package1')
     ->addDependency('package2');

$generatedTree = $tree->generateTree();
```

The `generatedTree` contains :

```
array(1) {
  [0]=> array(1) {
    [0]=> array(2) {
      [0]=> string(8) "package1"
      [1]=> string(8) "package2"
    }
  }
```

\### Advanced usage

```
$tree = new \bultonFr\DependencyTree\DependencyTree;
$tree->addDependency('package1')
     ->addDependency('package2', 1)
     ->addDependency('package3', 1, ['package2'])
     ->addDependency('package4', 0, ['package2'])
     ->addDependency('package5', 1, ['package4'])
     ->addDependency('package6', 1, ['package3', 'package5'])
     ->addDependency('package7', 3)
     ->addDependency('package8', 3);

$generatedTree = $tree->generateTree();
```

The `generatedTree` contains :

```
array(3) {
  [0]=> array(1) {
    [0]=> array(1) {
      [0]=> string(8) "package1"
    }
  }
  [1]=> array(4) {
    [0]=> array(1) {
      [0]=> string(8) "package2"
    }
    [1]=> array(1) {
      [0]=> string(8) "package4"
    }
    [2]=> array(2) {
      [0]=> string(8) "package3"
      [1]=> string(8) "package5"
    }
    [3]=> array(1) {
      [0]=> string(8) "package6"
    }
  }
  [3]=> array(1) {
    [0]=> array(2) {
      [0]=> string(8) "package7"
      [1]=> string(8) "package8"
    }
  }
}
```

In a graphic representation :

[![dependency-tree graphic reprensentation](https://camo.githubusercontent.com/9efb851b6be0cbafb95d4a2b0402bf186da7ea293b89200b0e77a132a0e152da/68747470733a2f2f70726f6a656374732e62756c746f6e2e66722f646570656e64656e63792d747265652f6769746875622d726561646d652d677261706869632e706e67)](https://camo.githubusercontent.com/9efb851b6be0cbafb95d4a2b0402bf186da7ea293b89200b0e77a132a0e152da/68747470733a2f2f70726f6a656374732e62756c746f6e2e66722f646570656e64656e63792d747265652f6769746875622d726561646d652d677261706869632e706e67)

At left we see the first tree with the list of package at their time loader. At right, we see the tree for the second line, with packages sorted to be loaded in the correct order.

Note : The package "package4" is declared to be loaded in the first line. But its dependencies are declared to be loaded in the second line. So the "package4" has be moved to be loaded in the same line as its dependencies

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance43

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 93.2% 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 ~0 days

Total

6

Last Release

3621d ago

PHP version history (3 changes)1.0.0PHP &gt;=5.4.0

1.0.x-devPHP &gt;=5.6.0

1.2.0PHP ^5.6|^7.0|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8878310e46e073ed70452f0f16ebb5bf177a484811e2b19b2f48d8e2035279a8?d=identicon)[bulton-fr](/maintainers/bulton-fr)

---

Top Contributors

[![bulton-fr](https://avatars.githubusercontent.com/u/2345417?v=4)](https://github.com/bulton-fr "bulton-fr (41 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (3 commits)")

---

Tags

phpdependency tree

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bulton-fr-dependency-tree/health.svg)

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

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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