PhpDependencyAnalysis 0,0 scrutinizer travis-ci Packagist phpunit

:mag: Static code analysis to provide and verify a dependency graph against a defined architecture


Author Build Status Latest Stable Version Total Downloads License


PhpDependencyAnalysis is an extendable static code analysis for object-oriented PHP-Projects to provide dependency graphs for abstract datatypes (Classes, Interfaces and Traits) based on namespaces. Dependencies can be aggregated to build graphs for several levels, like Package-Level or Layer-Level. Each dependency can be verified to your defined architecture.

Read the Introduction-Chapter for further informations.


See more examples.


For graph creation GraphViz is required on your machine, which is an open source graph visualization software and available for the most platforms.

After installing GraphViz the recommended way to install mamuz/php-dependency-analysis is through composer:

$ composer require mamuz/php-dependency-analysis


  • Providing high customizing level
  • Dependency graph creation on customized levels respectively different scopes and layers
  • Supports Usage-Graph, Call-Graph and Inheritance-Graph
  • Dependencies can be aggregated to a package, a module or a layer
  • Detecting cycles and violations between layers in a tiered architecture
  • Verifiying dependency graph against a user-defined reference architecture
  • Collected Namespaces of dependencies are modifiable to meet custom use cases
  • Printing graphs in several formats (HTML, SVG, DOT, JSON)
  • Extandable by adding user-defined plugins for collecting and displaying dependencies
  • Compatible to PHP7 Features, like Return Type Declarations and Anonymous Classes


This tool is configurable by a YAML file. You can copy a prepared file from the vendor directory.

$ cp ./vendor/mamuz/php-dependency-analysis/phpda.yml.dist ./myconfig.yml

See prepared configuration and read the Configuration-Chapter for available options.


Run this command line to create a dependecy graph:

$ ./vendor/bin/phpda analyze ./myconfig.yml

After that open created report file with your prefered tool.


  1. Introduction
  2. Requirements
  3. Configuration
  4. Examples
  5. Plugins

Code of Conduct

As contributors and maintainers of this project you have to respect the Code of Coduct


See record of changes made to this project here


Before opening up a pull-request please read the Contributing-Guideline


Check the resources in Code Analysis Section at Awesome PHP

Related Repositories



:mag: Static code analysis to provide and verify a dependency graph against a defined architecture ...

Top Contributors

mamuz fonsecas72 otruffer garex jakzal tobiasoberrauch


package version
php ^5.6 || ^7.0
psr/log ~1.0
nikic/php-parser ~2.0|~3.0
clue/graph ~0.8
graphp/algorithms ~0.8.1
graphp/graphviz ~0.2.0
phpdocumentor/reflection-docblock ~3.1
doctrine/collections ~1.0
symfony/yaml ~2.5|~3.0
symfony/console ~2.8|~3.0
symfony/finder ~2.8|~3.0
padraic/phar-updater ~1.0
dev mockery/mockery ~0.9.2
codeception/codeception ^2.2


-   v1.2.0 zip tar
-   v1.1.1 zip tar
-   v1.1.0 zip tar
-   v1.0.0 zip tar
-   v0.6.1 zip tar
-   v0.6.0 zip tar
-   v0.5.3 zip tar
-   v0.5.2 zip tar
-   v0.5.1 zip tar
-   v0.5.0 zip tar
-   v0.4.2 zip tar
-   v0.4.1 zip tar
-   v0.4.0 zip tar
-   v0.3.4 zip tar
-   v0.3.3 zip tar
-   v0.3.2 zip tar
-   v0.3.1 zip tar
-   v0.3.0 zip tar
-   v0.2.1 zip tar
-   v0.2.0 zip tar
-   v0.1.3 zip tar
-   v0.1.0 zip tar
-   v0.1.0-beta zip tar
-   v0.0.1 zip tar
-   v0.0.1-beta.3 zip tar
-   v0.0.1-beta.2 zip tar
-   v0.0.1-beta zip tar