Skip to content

fonsecas72/PhpDependencyAnalysis

 
 

Repository files navigation

PhpDependencyAnalysis

Author Build Status Coverage Status Quality Score HHVM Status Dependency Status

Latest Stable Version Total Downloads License

SensioLabsInsight

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.

Example

See more examples.

Installation

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.*"
    }
}

PHP-Version

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.

Features

  • 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

Configuration

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.

Usage

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

See record of changes made to this project here

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

Alternatives

Check the resources in Code Analysis Section at Awesome PHP

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 99.9%
  • Batchfile 0.1%