Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Basis library to resolve dependencies with graph / tree

License

Notifications You must be signed in to change notification settings

anthonykgross/dependency-resolver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Installing anthonykgross/dependency-resolver

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

# Install Composer
curl -sS https://getcomposer.org/installer | php

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

php composer.phar require anthonykgross/dependency-resolver "dev-master"

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

You can then later update dependency-resolver using composer:

composer.phar update

Usage

$tree  = array(
   'A' => array(),
   'B' => array('A'),
   'C' => array('B'),
   'D' => array('C', 'A'),
   'E' => array('C', 'B'),
);
$resolution = \Algorithm\DependencyResolver::resolve($tree);
print($resolution);
// ['A','B','C','D','E']

OR

$tree  = array(
    'A' => array('B'),
    'B' => array('C'),
    'C' => array('A'),
);
$resolution = \Algorithm\DependencyResolver::resolve($tree);
// RuntimeException : Circular dependency: C -> A

Documentation

Contributors

Anthony K GROSS

Joshua Behrens

Copyright and license

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