PhpMetrics is a static analysis tool for PHP

Quickstart

PhpMetrics provides various metrics about PHP projects.

Installation

composer global require 'phpmetrics/phpmetrics'
phpmetrics --report-html=myreport.html /path/of/your/sources

Readable & Accessible reports

PhpMetrics is designed to be understable and easy to use. Thanks to d3js, it will scores your project with beautiful graphs. PhpMetrics has a "colorblind mode".
Do not hesitate to visit the demo.

animated and anooted demo of PhpMetrics report

Continuous Integration

PhpMetrics interacts with Jenkins or Sonar. It provides reports in many formats (XML, violations, HTML, CSV...). More in Documentation.

Plugins and extensions

PhpMetrics can be extended with plugins (Symfony2...). More in Discover how.

Metrics

PHPMetrics provides tons of metrics:

  • Complexity: Cyclomatic complexity, Myer's interval, Relative system complexity
  • Volume: Vocabulary, Data complexity, Lines of code, Readability...
  • Object Oriented: Lack of cohesion of methods, Coupling, Abstraction...
  • Maintainability: Maintainability index, Halstead's metrics, Effort...
  • And more !

Open source and free

PhpMetrics is hosted under MIT license on Github.

PhpMetrics is an Open Source project created by Jean-François Lépine (Halleck45).

Contributors

a big thanks to all contributors !