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 by adding dependency to your composer.json
:
{
"require-dev": {
"mamuz/php-dependency-analysis": "1.*"
}
}
To run the newest version of this tool, it requires PHP >= 5.5. For running on machines with PHP < 5.5 have a look to 0.* releases.
- 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
andAnonymous 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.
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