2017 © Pedro Peláez
 

project php-dependency-analysis

Static code analysis to find violations in a dependency graph

image

mamuz/php-dependency-analysis

Static code analysis to find violations in a dependency graph

  • Thursday, April 20, 2017
  • by mamuz
  • Repository
  • 26 Watchers
  • 329 Stars
  • 47,538 Installations
  • PHP
  • 70 Dependents
  • 0 Suggesters
  • 25 Forks
  • 12 Open issues
  • 30 Versions
  • 8 % Grown

The README.md

PhpDependencyAnalysis

Author Build Status Latest Stable Version Total Downloads License, (*1)

PhpDependencyAnalysis is an extendable static code analysis for object-oriented PHP-Projects to generate dependency graphs from 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 a defined architecture., (*2)

Read the Introduction-Chapter for further informations., (*3)

Example

, (*4)

See more examples., (*5)

Installation

As a Docker Image (recommend way)

docker pull mamuz/phpda

As a Composer Dependency

NOTE: For graph creation GraphViz is required on your machine, which is an open source graph visualization software and available for the most platforms., (*6)

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

As a Phar

Since version 2.0.0 not supported anymore., (*7)

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 and Anonymous Classes

Usage

Phpda can run out of the box by using a prepared configuration. As you can see configuration is defined by a YAML file., (*8)

To provide your own configuration create a yml file, e.g. located in ./phpda.yml:, (*9)

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:, (*10)

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

Read the Configuration-Chapter to get knowledge about all available options., (*11)

Wiki

  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, (*12)

Changelog

See record of changes made to this project here, (*13)

Contributing

Before opening up a pull-request please read the Contributing-Guideline, (*14)

Alternatives

Check the resources in Satic Analysis Section at Awesome PHP, (*15)

The Versions

13/09 2015

v0.6.0

0.6.0.0 https://github.com/mamuz/PhpDependencyAnalysis

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace architecture reference cycles

05/07 2015

v0.5.3

0.5.3.0 https://github.com/mamuz/PhpDependencyAnalysis

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace architecture reference cycles

21/06 2015

v0.5.2

0.5.2.0 https://github.com/mamuz/PhpDependencyAnalysis

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace architecture reference cycles

04/06 2015

v0.5.1

0.5.1.0 https://github.com/mamuz/PhpDependencyAnalysis

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace architecture reference cycles

16/05 2015
10/05 2015
28/03 2015
08/02 2015

v0.4.0

0.4.0.0 https://github.com/mamuz/PhpDependencyAnalysis

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace architecture reference cycles

21/01 2015

v0.3.4

0.3.4.0 https://github.com/mamuz/PhpDependencyAnalysis

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace architecture reference cycles

17/01 2015

v0.3.3

0.3.3.0 https://github.com/mamuz/PhpDependencyAnalysis

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace architecture reference cycles

17/01 2015

v0.3.2

0.3.2.0 https://github.com/mamuz/PhpDependencyAnalysis

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace architecture reference cycles

13/01 2015

v0.3.1

0.3.1.0 https://github.com/mamuz/PhpDependencyAnalysis

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace architecture reference cycles

30/11 2014
19/11 2014

v0.1.3

0.1.3.0 https://github.com/mamuz/PhpDependencyAnalysis

Static code analysis for php projects to provide a dependency graph based on namespaces

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace

16/11 2014

v0.1.0

0.1.0.0 https://github.com/mamuz/PhpDependencyAnalysis

Static code analysis for php projects to provide a dependency graph based on namespaces

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace

15/11 2014

v0.1.0-beta

0.1.0.0-beta https://github.com/mamuz/PhpDependencyAnalysis

Static code analysis for php projects to provide a dependency graph based on namespaces

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace

26/10 2014

v0.0.1

0.0.1.0 https://github.com/mamuz/PhpDependencyAnalysis

Static code analysis for php projects to provide a dependency graph based on namespaces

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace

19/10 2014

v0.0.1-beta.3

0.0.1.0-beta3 https://github.com/mamuz/PhpDependencyAnalysis

Static code analysis for php projects to provide a dependency graph based on namespaces

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace

16/10 2014

v0.0.1-beta.2

0.0.1.0-beta2 https://github.com/mamuz/PhpDependencyAnalysis

Static code analysis for php projects to provide a dependency graph based on namespaces

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace

07/10 2014

v0.0.1-beta

0.0.1.0-beta https://github.com/mamuz/PhpDependencyAnalysis

Static code analysis for php projects to provide a dependency graph based on namespaces

  Sources   Download

MIT

The Requires

 

The Development Requires

by Marco Muths

php code analysis graph dependency namespace