PHPackages                             mdagostino/dependencyresolver - 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. mdagostino/dependencyresolver

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

mdagostino/dependencyresolver
=============================

Generic dependency resolver. Returns a flat array of components to load them respecting their dependencies.

1.0.0(11y ago)120MITPHP

Since Oct 22Pushed 8y agoCompare

[ Source](https://github.com/mariano-dagostino/DependencyResolver)[ Packagist](https://packagist.org/packages/mdagostino/dependencyresolver)[ RSS](/packages/mdagostino-dependencyresolver/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (5)Used By (0)

Dependency Resolver
===================

[](#dependency-resolver)

[![Build Status](https://camo.githubusercontent.com/d3cad2fe3903e8e0e280faf8a80ae382cdaaca3aca8189990b89bdf29b4db139/68747470733a2f2f7472617669732d63692e6f72672f6d617269616e6f2d6461676f7374696e6f2f446570656e64656e63795265736f6c7665722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mariano-dagostino/DependencyResolver)

This package allows to define a set of generic components that depends on other components. The DependencyResolver will then define the order of loading of those components.

Basic usage
-----------

[](#basic-usage)

```
use mdagostino\DependencyResolver\DependencyResolver;

$resolver = new DependencyResolver();
$resolver
  ->component('ITEM 1')->requires('ITEM 3', 'ITEM 4') // Item 1 requires item 3 and 4.
  ->component('ITEM 2')->requires('ITEM 1')           // Item 2 requires item 1.
  ->component('ITEM 3')                               // Item 3 doesn't have dependencies.
  ->component('ITEM 4');                              // Item 4 doesn't have dependencies.

$ordered = $resolver->resolveDependencies();
print_r($ordered);
// Prints:
// ITEM 3
// ITEM 4
// ITEM 1
// ITEM 2
```

Features.
---------

[](#features)

### Circular dependency detection.

[](#circular-dependency-detection)

Example:

```
use mdagostino\DependencyResolver\DependencyResolver;

$resolver = new DependencyResolver();
$resolver
  ->component('A')->requires('B')
  ->component('B')->requires('A');

$ordered = $resolver->resolveDependencies();

// Trow Exception: "Circular dependency detected"
```

### Check that all the components have been defined.

[](#check-that-all-the-components-have-been-defined)

Example:

```
use mdagostino\DependencyResolver\DependencyResolver;

$resolver = new DependencyResolver();
$resolver
  ->component('A')->requires('B', 'C')
  ->component('B');

  $ordered = $resolver->resolveDependencies();
  // Trow Exception: "There is a component not defined: C"
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity66

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

4271d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0750f94642b82ce97a73314577eb5435ea9710f0ad8b92ce47f2302aea2cf562?d=identicon)[mdagostino](/maintainers/mdagostino)

---

Top Contributors

[![mariano-dagostino](https://avatars.githubusercontent.com/u/5313631?v=4)](https://github.com/mariano-dagostino "mariano-dagostino (15 commits)")

### Embed Badge

![Health badge](/badges/mdagostino-dependencyresolver/health.svg)

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

PHPackages © 2026

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