Skip to content

Latest commit

 

History

History
57 lines (46 loc) · 1.4 KB

README.md

File metadata and controls

57 lines (46 loc) · 1.4 KB

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.