Skip to content

Basis library to resolve dependencies with graph / tree

License

Notifications You must be signed in to change notification settings

HEPTACOM/dependency-resolver

 
 

Repository files navigation

Installing heptacom/dependency-resolver

The recommended way to install heptacom/dependency-resolver is through Composer.

Next, run the Composer command to install the latest stable version of dependency-resolver:

composer require heptacom/dependency-resolver

You can then later update dependency-resolver using composer:

composer update heptacom/dependency-resolver

Usage

$tree  = [
    'A' => [],
    'B' => ['A'],
    'C' => ['B'],
    'D' => ['C', 'A'],
    'E' => ['C', 'B'],
];
$resolution = (new \Heptacom\DependencyResolver\DependencyResolver())->resolve($tree);
print($resolution);
// ['A','B','C','D','E']

OR

$tree  = [
    'A' => ['B'],
    'B' => ['C'],
    'C' => ['A'],
];
$resolution = (new \Heptacom\DependencyResolver\DependencyResolver())->resolve($tree);
// RuntimeException : Circular dependency: C -> A

Documentation

Contributors

Joshua Behrens

Anthony K GROSS (Original author)

Copyright and license

Code and documentation copyright 2020. Code released under the MIT license.

About

Basis library to resolve dependencies with graph / tree

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 73.7%
  • Makefile 26.3%