PHP Metrics : Static analysis tool for PHP


Quality assurance is a key element to make your PHP code clean, simple, easy to maintain, secure and free of bugs ! One of the great tools that you can use to analyse the quality of your PHP code is : PHP Metrics.  An open source static analysis tool for PHP,  providing a bunch of metrics in one single tool :

  • maintainability Index
  • Cyclomatic complexity
  • Halstead’s metrics
  • Lack of cohesion of methods
  • Abstraction/Instability
  • and more…


A plugin is available to use PHP metrics with PHPStorm IDE, but also it’s easy to integrate it with the open-source continuous integration server Jenkins.

PHP metrics is released under a MIT License, you can get it from github :
chmod +x phpmetrics.phar
mv phpmetrics.phar /usr/local/bin/phpmetrics

Overall it’s a great and neat tool that can help you make high quality code.


Leave a Reply