PHPackages                             mamuz/php-dependency-analysis - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. mamuz/php-dependency-analysis

ActiveProject[Testing &amp; Quality](/categories/testing)

mamuz/php-dependency-analysis
=============================

Static code analysis to find violations in a dependency graph

v2.0.2(7y ago)573108.5k43[9 issues](https://github.com/mamuz/PhpDependencyAnalysis/issues)[6 PRs](https://github.com/mamuz/PhpDependencyAnalysis/pulls)20MITPHPPHP ^7.3

Since Oct 7Pushed 2y ago28 watchersCompare

[ Source](https://github.com/mamuz/PhpDependencyAnalysis)[ Packagist](https://packagist.org/packages/mamuz/php-dependency-analysis)[ Docs](https://github.com/mamuz/PhpDependencyAnalysis)[ RSS](/packages/mamuz-php-dependency-analysis/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (36)Used By (20)

PhpDependencyAnalysis
=====================

[](#phpdependencyanalysis)

[![Author](https://camo.githubusercontent.com/e49859db77ebe675300539af2d01c10b7568b92df2dbbd190335170cd198e5fa/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d406d616d757a5f64652d626c75652e7376673f7374796c653d666c61742d737175617265)](https://twitter.com/mamuz_de)[![Build Status](https://camo.githubusercontent.com/c975b59e7604a442b18a090638c04f8f368f702efe26264275332699b9e4acb8/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6d616d757a2f506870446570656e64656e6379416e616c797369732e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/mamuz/PhpDependencyAnalysis)[![Latest Stable Version](https://camo.githubusercontent.com/73572d886c9819e3e4ea9d6713306dbe6e70430cca1a2cda8ca8118ab1cfc057/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d616d757a2f7068702d646570656e64656e63792d616e616c797369732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mamuz/php-dependency-analysis)[![Total Downloads](https://camo.githubusercontent.com/023898e974937e2efaf02785be88a9a65e801656cb6105978cea48a8220c765e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d616d757a2f7068702d646570656e64656e63792d616e616c797369732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mamuz/php-dependency-analysis)[![License](https://camo.githubusercontent.com/3b342fa879461d206d96a98c79ff4ea24347155056528ac73b17556d5a2de961/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d616d757a2f7068702d646570656e64656e63792d616e616c797369732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mamuz/php-dependency-analysis)

PhpDependencyAnalysis is an extendable static code analysis for object-oriented PHP-Projects to generate [`dependency graphs`](http://en.wikipedia.org/wiki/Dependency_graph)from abstract datatypes (Classes, Interfaces and Traits) based on [`namespaces`](http://php.net/manual/en/language.namespaces.php). Dependencies can be aggregated to build graphs for several levels, like Package-Level or Layer-Level. Each dependency can be verified to a defined architecture.

Read the [Introduction-Chapter](https://github.com/mamuz/PhpDependencyAnalysis/wiki/1.-Introduction) for further informations.

### Example

[](#example)

[![](https://camo.githubusercontent.com/0bff2e1b849b3395f53ad499a2496764f48886e0674aa39b06f6dca7e0b363b1/68747470733a2f2f63646e2e7261776769742e636f6d2f6d616d757a2f506870446570656e64656e6379416e616c797369732f6d61737465722f74657374732f5f646174612f7376672f6578706563746174696f6e2f7061636b616765732e737667)](https://camo.githubusercontent.com/0bff2e1b849b3395f53ad499a2496764f48886e0674aa39b06f6dca7e0b363b1/68747470733a2f2f63646e2e7261776769742e636f6d2f6d616d757a2f506870446570656e64656e6379416e616c797369732f6d61737465722f74657374732f5f646174612f7376672f6578706563746174696f6e2f7061636b616765732e737667)

See more [examples](https://github.com/mamuz/PhpDependencyAnalysis/wiki/4.-Examples).

Installation
------------

[](#installation)

### As a Docker Image (recommend way)

[](#as-a-docker-image-recommend-way)

```
docker pull mamuz/phpda
```

### As a Composer Dependency

[](#as-a-composer-dependency)

**NOTE:** For graph creation [`GraphViz`](http://www.graphviz.org/) is required on your machine, which is an open source graph visualization software and available for the most platforms.

```
$ composer require --dev mamuz/php-dependency-analysis
```

### As a Phar

[](#as-a-phar)

Since version 2.0.0 not supported anymore.

Features
--------

[](#features)

- High customizing level
- Graph creation on customized levels respectively different scopes and layers
- Supports Usage-Graph, Call-Graph and Inheritance-Graph
- Dependencies can be aggregated such as 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
- Compatible to PHP7 Features, like [`Return Type Declarations`](https://wiki.php.net/rfc/return_types) and [`Anonymous Classes`](https://wiki.php.net/rfc/anonymous_classes)

Usage
-----

[](#usage)

Phpda can run out of the box by using a prepared [`configuration`](https://github.com/mamuz/PhpDependencyAnalysis/blob/master/phpda.yml.dist). As you can see configuration is defined by a [`YAML`](http://en.wikipedia.org/wiki/YAML) file.

To provide your own configuration create a yml file, e.g. located in `./phpda.yml`:

```
mode: 'usage'
source: './src'
filePattern: '*.php'
ignore: 'tests'
formatter: 'PhpDA\Writer\Strategy\Svg'
target: './phpda.svg'
groupLength: 1
visitor:
  - PhpDA\Parser\Visitor\TagCollector
  - PhpDA\Parser\Visitor\SuperglobalCollector
visitorOptions:
  PhpDA\Parser\Visitor\Required\DeclaredNamespaceCollector: {minDepth: 2, sliceLength: 2}
  PhpDA\Parser\Visitor\Required\MetaNamespaceCollector: {minDepth: 2, sliceLength: 2}
  PhpDA\Parser\Visitor\Required\UsedNamespaceCollector: {minDepth: 2, sliceLength: 2}
  PhpDA\Parser\Visitor\TagCollector: {minDepth: 2, sliceLength: 2}
```

Perform an analysis with that configuration:

```
$ docker run --rm -v $PWD:/app mamuz/phpda
```

Read the [Configuration-Chapter](https://github.com/mamuz/PhpDependencyAnalysis/wiki/3.-Configuration)to get knowledge about all available options.

[Wiki](https://github.com/mamuz/PhpDependencyAnalysis/wiki)
-----------------------------------------------------------

[](#wiki)

1. [Introduction](https://github.com/mamuz/PhpDependencyAnalysis/wiki/1.-Introduction)
2. [Requirements](https://github.com/mamuz/PhpDependencyAnalysis/wiki/2.-Requirements)
3. [Configuration](https://github.com/mamuz/PhpDependencyAnalysis/wiki/3.-Configuration)
4. [Examples](https://github.com/mamuz/PhpDependencyAnalysis/wiki/4.-Examples)
5. [Plugins](https://github.com/mamuz/PhpDependencyAnalysis/wiki/5.-Plugins)

[Code of Conduct](https://github.com/mamuz/PhpDependencyAnalysis/blob/master/.github/CODE_OF_CONDUCT.md)
--------------------------------------------------------------------------------------------------------

[](#code-of-conduct)

As contributors and maintainers of this project you have to respect the [Code of Coduct](https://github.com/mamuz/PhpDependencyAnalysis/blob/master/.github/CODE_OF_CONDUCT.md)

[Changelog](https://github.com/mamuz/PhpDependencyAnalysis/blob/master/CHANGELOG.md)
------------------------------------------------------------------------------------

[](#changelog)

See record of changes made to this project [here](https://github.com/mamuz/PhpDependencyAnalysis/blob/master/CHANGELOG.md)

[Contributing](https://github.com/mamuz/PhpDependencyAnalysis/blob/master/.github/CONTRIBUTING.md)
--------------------------------------------------------------------------------------------------

[](#contributing)

Before opening up a pull-request please read the [Contributing-Guideline](https://github.com/mamuz/PhpDependencyAnalysis/blob/master/.github/CONTRIBUTING.md)

Alternatives
------------

[](#alternatives)

Check the resources in [Satic Analysis Section at Awesome PHP](https://github.com/ziadoz/awesome-php#static-analysis)

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity51

Moderate usage in the ecosystem

Community41

Growing community involvement

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 95.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~53 days

Recently: every ~186 days

Total

32

Last Release

2593d ago

Major Versions

v0.6.1 → v1.0.02016-02-07

v1.3.1 → v2.0.02019-04-11

PHP version history (5 changes)v0.0.1-betaPHP &gt;=5.4

v0.0.1PHP &gt;=5.3.3

v1.0.0PHP &gt;=5.5

v1.3.0PHP ^5.6 || ^7.0

v2.0.0PHP ^7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/c1cf66a1ce705b8bd26f30eb171db09bdd4fae0bc5997acbd747303dbaa3a03c?d=identicon)[mamuz](/maintainers/mamuz)

---

Top Contributors

[![mamuz](https://avatars.githubusercontent.com/u/4173317?v=4)](https://github.com/mamuz "mamuz (586 commits)")[![gwi-mmuths](https://avatars.githubusercontent.com/u/29041888?v=4)](https://github.com/gwi-mmuths "gwi-mmuths (15 commits)")[![cawolf](https://avatars.githubusercontent.com/u/1932623?v=4)](https://github.com/cawolf "cawolf (3 commits)")[![otruffer](https://avatars.githubusercontent.com/u/410402?v=4)](https://github.com/otruffer "otruffer (3 commits)")[![LeoVie](https://avatars.githubusercontent.com/u/7249788?v=4)](https://github.com/LeoVie "LeoVie (2 commits)")[![jakzal](https://avatars.githubusercontent.com/u/190447?v=4)](https://github.com/jakzal "jakzal (1 commits)")[![itcreator](https://avatars.githubusercontent.com/u/928509?v=4)](https://github.com/itcreator "itcreator (1 commits)")[![mikaelmattsson](https://avatars.githubusercontent.com/u/2428696?v=4)](https://github.com/mikaelmattsson "mikaelmattsson (1 commits)")[![garex](https://avatars.githubusercontent.com/u/77981?v=4)](https://github.com/garex "garex (1 commits)")[![sauron07](https://avatars.githubusercontent.com/u/3647206?v=4)](https://github.com/sauron07 "sauron07 (1 commits)")

---

Tags

code-analysiscode-qualitydependency-graphphpreference-architecturedependencyanalysisarchitecturegraphphpda

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/mamuz-php-dependency-analysis/health.svg)

```
[![Health](https://phpackages.com/badges/mamuz-php-dependency-analysis/health.svg)](https://phpackages.com/packages/mamuz-php-dependency-analysis)
```

###  Alternatives

[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[phpbench/phpbench

PHP Benchmarking Framework

2.0k13.0M627](/packages/phpbench-phpbench)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[maglnet/composer-require-checker

CLI tool to analyze composer dependencies and verify that no unknown symbols are used in the sources of a package

99810.9M671](/packages/maglnet-composer-require-checker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
