anthonykgross / dependency-resolver
dependency-resolver
Installs: 143 695
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.2
Requires (Dev)
- ext-curl: *
- phpunit/phpunit: ^6.0 | ^7.0
This package is not auto-updated.
Last update: 2024-02-23 18:42:23 UTC
README
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
- https://www.electricmonk.nl/log/2008/08/07/dependency-resolving-algorithm/
- http://mamchenkov.net/wordpress/2016/11/22/dependency-resolution-with-graphs-in-php/
Contributors
Anthony K GROSS
Joshua Behrens
Copyright and license
Code and documentation copyright 2020. Code released under the MIT license.