nusje2000/dependency-graph
最新稳定版本:v2.6.0
Composer 安装命令:
composer require nusje2000/dependency-graph
包简介
A PHP Library for resolving, visualizing and validating composer dependencies within a repository. Works within a monolithic repository as well.
README 文档
README
This package can be used to create a list of used packages and their dependencies.
Installation
Using composer:
composer require nusje2000/dependency-graph --dev
Usage
use Nusje2000\DependencyGraph\Cache\FileCache; use Nusje2000\DependencyGraph\DependencyGraph; // By default the DependencyGraph won't cache the result $graph = DependencyGraph::build('/path/to/project/root'); // Using the FileCache to cache the dependency graph $graph = DependencyGraph::build('/path/to/project/root', null, new FileCache());
The build method uses 3 parameters:
- The root path, this is the path to the root of your project.
- The builder, this class is used to build the dependency graph (leave null for default implementation).
- The cache class, this class will be used to cache the result or to load the graph from if a cache exists.
Visualizing dependencies
You can visualize the dependency graph by using vendor/bin/dependency-graph search.
This console command can be used to search through the graph and look at
information about certain packages. This command is still being worked on.
There is also a command for only visualizing a package (without the
search dialog). i.e. you can use vendor/bin/dependency-graph info nusje2000/dependency-graph
to see the dependencies of this package.
Validating the dependency graph in monolithic repositories
This package can be used to fetch all the packages defined in monolithic
repositories. This has been implemented into a command in the
nusje2000/composer-monolith package, which can be used to validate
internal and external dependencies in a monolithic repository.
Accessing the dependency graph
use Nusje2000\DependencyGraph\DependencyGraph; // building the dependency graph $graph = DependencyGraph::build('/path/to/project/root'); // get the root path $graph->getRootPath(); // get all packages $packages = $graph->getPackages(); // checking if a package exists $graph->hasPackage('foo/foo-pacakge'); // getting a specific package $fooPackage = $graph->getPackage('foo/foo-pacakge'); $fooPackage->getName(); // return the name of the package (foo/foo-pacakge) $fooPackage->getDependencies(); // returns a list of dependencies $fooPackage->getPackageLocation(); // returns the location of the package
统计信息
- 总下载量: 29.24k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-02