talira

PHP Mess Detector: finds bugs and code smells in PHP

open sourceBSD-3-Clausefree

PHPMD (PHP Mess Detector) scans PHP source code for likely bugs, suboptimal code, overcomplicated expressions and unused parameters, methods and properties, using a set of predefined, configurable rule sets. It is a spin-off of PHP Depend and aims to be PHP's equivalent of the Java tool PMD, working as a friendly front end to the metrics PHP Depend measures. You run it from the command line or in CI, installed with Composer.

Problems it solves

  • find unused code and overly complex methods in our PHP codebase
  • a PHP linter for code smells to run in CI
  • something like PMD for PHP

Features

  • rules for possible bugs, unused code and overcomplicated expressions
  • configurable rule sets
  • command line and CI use
  • built on PHP Depend metrics

Alternatives

The same job

These do what PHPMD does.

  1. PHPStan PHP static analysis that finds bugs without running your code
  2. PHPCompatibility PHP_CodeSniffer sniffs that check PHP code for cross-version compatibility
  3. PHP_CodeSniffer Detect and fix coding standard violations in PHP
  4. PHPLint Lint PHP files faster by running several lint processes at once
  5. MegaLinter Linting suite that checks every language, format and config file in a repository
  6. Slevomat Coding Standard Extra PHP_CodeSniffer sniffs for safer, cleaner and consistently formatted PHP

Compare PHPMD with the top 3