PHPackages                             nazonohito51/dependency-analyzer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. nazonohito51/dependency-analyzer

ActiveLibrary

nazonohito51/dependency-analyzer
================================

Analyze/Verify class dependencies in PHP.

v0.3.0(6y ago)275494[2 PRs](https://github.com/nazonohito51/dependency-analyzer/pulls)1MITPHPPHP ~7.1CI failing

Since Mar 31Pushed 5y ago3 watchersCompare

[ Source](https://github.com/nazonohito51/dependency-analyzer)[ Packagist](https://packagist.org/packages/nazonohito51/dependency-analyzer)[ RSS](/packages/nazonohito51-dependency-analyzer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (9)Used By (1)

DependencyAnalyzer
==================

[](#dependencyanalyzer)

Analyze/Verify dependency map for php.

[![Latest Stable Version](https://camo.githubusercontent.com/bceaf72c8e68780be977e1de907d97174c9357edcfb705891265e66e06df65ca/68747470733a2f2f706f7365722e707567782e6f72672f6e617a6f6e6f6869746f35312f646570656e64656e63792d616e616c797a65722f76657273696f6e)](https://packagist.org/packages/nazonohito51/dependency-analyzer)[![Build Status](https://camo.githubusercontent.com/8146279145a7296a92af69dd0af1cbbb36b403df6bd8b2d575b4d6876a184945/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e617a6f6e6f6869746f35312f646570656e64656e63792d616e616c797a65722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/nazonohito51/dependency-analyzer/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9d9c635c2508a7cdd70b420373d513054bb28e124cef32a6625eeead6df53e1f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e617a6f6e6f6869746f35312f646570656e64656e63792d616e616c797a65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/nazonohito51/dependency-analyzer/?branch=master)

Description
-----------

[](#description)

Dependency analyzer help you to keep cleaning your architecture.

If you start to managing dependencies between classes likely [Clean Architecture](http://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) or Layered Architecture, you will aware inspecting dependency between classes by eyes is very difficult in PHP. This library analyze dependencies in your repository, and take some way of using it to you.(Example: Create UML graph, Verify by your rule, Detect cycle path)

Basic Usages
------------

[](#basic-usages)

This library have several functions. If you have error when use them, see [Trouble Shooting](https://github.com/nazonohito51/dependency-analyzer/wiki/Trouble-shooting).

### Create dependency graph

[](#create-dependency-graph)

[![graph](./dependency_graph_sample.png)](./dependency_graph_sample.png)

```
php vendor/bin/analyze-deps graph --output ./graph.puml ./some/analyze/dir1 ./some/analyze/dir2
```

Analysis dependency map and create graph. Now, dependency analyzer support only [Plant UML](https://github.com/plantuml/plantuml) format.

Maybe, your graph will have many classes, and is very complex! If you need to simplify your graph, see [Advanced Usage](#advanced-usages).

### Verify your dependency rule

[](#verify-your-dependency-rule)

In Clean Architecture, there is dependency rules between classes. You can define your dependency rule, and this library will detect rule violation in your repository and notify them to you.

First, you can define your rule by php file, like below:

```
