Stars: 554
Forks: 60
Pull Requests: 24
Issues: 34
Watchers: 28
Last Updated: 2022-06-21 17:42:09
Static code analysis to find violations in a dependency graph
License: MIT License
Languages: PHP, Batchfile, Makefile, Shell, Dockerfile
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.
Read the Introduction-Chapter for further informations.
See more examples.
docker pull mamuz/phpda
NOTE: For graph creation GraphViz
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
Since version 2.0.0 not supported anymore.
Return Type Declarations
and Anonymous Classes
Phpda can run out of the box by using a prepared configuration
.
As you can see configuration is defined by a 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 to get knowledge about all available options.
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 Satic Analysis Section at Awesome PHP