PHPackages                             digilist/dependency-graph - 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. digilist/dependency-graph

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

digilist/dependency-graph
=========================

Dependency Graph Resolver in PHP

v0.4.3(3mo ago)19541.2k↓34.1%7[1 PRs](https://github.com/digilist/dependency-graph/pulls)5MITPHPPHP &gt;=8.1CI passing

Since Apr 18Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/digilist/dependency-graph)[ Packagist](https://packagist.org/packages/digilist/dependency-graph)[ RSS](/packages/digilist-dependency-graph/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (6)Versions (9)Used By (5)

[![PHP](https://github.com/digilist/dependency-graph/actions/workflows/php.yml/badge.svg)](https://github.com/digilist/dependency-graph/actions/workflows/php.yml)

PHP DependencyGraph
===================

[](#php-dependencygraph)

This library provides a simple [Dependency Graph](http://en.wikipedia.org/wiki/Dependency_graph) resolver. It supports multiple root nodes which are detected automatically.

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

[](#installation)

You can install this library with Composer by requiring `digilist/dependency-graph`

Example Usage:
--------------

[](#example-usage)

There are two ways to define dependencies. One way is to define the dependencies directly on the node by calling the `dependsOn` method. By using this method you have to add the nodes manually to the graph (or at least the root nodes).

```
$nodeA = new DependencyNode('A');
$nodeB = new DependencyNode('B');
$nodeC = new DependencyNode('C');
$nodeD = new DependencyNode('D');
$nodeE = new DependencyNode('E');

$nodeA->dependsOn($nodeB);
$nodeA->dependsOn($nodeD);
$nodeB->dependsOn($nodeC);
$nodeB->dependsOn($nodeE);
$nodeC->dependsOn($nodeD);
$nodeC->dependsOn($nodeE);

$graph = new DependencyGraph();
$graph->addNode($nodeA);
$resolved = DependencyGraph->resolve(); // returns [D, E, C, B, A]
```

Alternatively, you can define the dependencies on the graph. By using this method, the root node will be automatically detected.

```
$graph = new DependencyGraph();

$nodeA = new DependencyNode('A');
$nodeB = new DependencyNode('B');
$nodeC = new DependencyNode('C');
$nodeD = new DependencyNode('D');
$nodeE = new DependencyNode('E');

$graph->addDependency($nodeA, $nodeB);
$graph->addDependency($nodeA, $nodeD);
$graph->addDependency($nodeB, $nodeC);
$graph->addDependency($nodeB, $nodeE);
$graph->addDependency($nodeC, $nodeD);
$graph->addDependency($nodeC, $nodeE);

$resolved = DependencyGraph->resolve(); // returns [D, E, C, B, A]
```

The passed payload to DependencyNode can be any arbitrary PHP element (primitive, array, object, resource...).

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance78

Regular maintenance activity

Popularity48

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~663 days

Recently: every ~857 days

Total

7

Last Release

116d ago

PHP version history (3 changes)v0.1PHP &gt;=5.3

v0.4PHP &gt;=8.2

v0.4.2PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/833667?v=4)[Markus Fasselt](/maintainers/digilist)[@digilist](https://github.com/digilist)

---

Top Contributors

[![digilist](https://avatars.githubusercontent.com/u/833667?v=4)](https://github.com/digilist "digilist (12 commits)")[![shyim](https://avatars.githubusercontent.com/u/6224096?v=4)](https://github.com/shyim "shyim (5 commits)")[![jasir](https://avatars.githubusercontent.com/u/115066?v=4)](https://github.com/jasir "jasir (3 commits)")[![mitelg](https://avatars.githubusercontent.com/u/6985627?v=4)](https://github.com/mitelg "mitelg (3 commits)")[![aragon999](https://avatars.githubusercontent.com/u/6317761?v=4)](https://github.com/aragon999 "aragon999 (2 commits)")[![JanWennrich](https://avatars.githubusercontent.com/u/42703348?v=4)](https://github.com/JanWennrich "JanWennrich (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/digilist-dependency-graph/health.svg)

```
[![Health](https://phpackages.com/badges/digilist-dependency-graph/health.svg)](https://phpackages.com/packages/digilist-dependency-graph)
```

###  Alternatives

[ampproject/amp-toolbox

A collection of AMP tools making it easier to publish and host AMP pages with PHP.

74640.3k1](/packages/ampproject-amp-toolbox)[compwright/codeigniter-installers

Composer installers for CodeIgniter

3484.3k4](/packages/compwright-codeigniter-installers)[pantheon-systems/pantheon_domain_masking

Domain masking middleware for Drupal

13357.8k](/packages/pantheon-systems-pantheon-domain-masking)

PHPackages © 2026

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