PHPMD is a command-line static analysis tool that examines PHP source code for maintainability problems and potential errors. It uses metrics collected by PHP Depend to identify code smells without executing the application.
The software looks for excessive complexity, problematic design, poor naming conventions, and unused code. Developers can combine predefined rulesets, customise individual checks, and set thresholds appropriate to their projects.
This is free and open source software.
Key Features
- Six predefined rulesets covering clean code, code size, controversial practices, design, naming, and unused code.
- Detects unused variables, private fields, methods, and function parameters.
- Measures cyclomatic complexity, NPath complexity, method length, class size, and excessive parameter lists.
- Identifies excessive coupling between objects and other object-oriented design problems.
- Supports custom rulesets and configuration files in YAML, XML, JSON, and PHP formats.
- Automatically detects project configuration files and provides an interactive configuration wizard.
- Includes a migration utility for converting older configuration files.
- Generates baselines to suppress existing violations while reporting newly introduced problems.
- Supports warning suppression using PHP attributes and detects redundant suppressions.
- Offers result caching and parallel source-file parsing to reduce analysis time.
- Accepts individual files, directories, multiple source paths, and standard input.
- Excludes selected files or directories and supports configurable filename extensions.
- Produces reports in text, ANSI, XML, HTML, JSON, SARIF, Checkstyle, GitHub, and GitLab formats.
- Provides configurable exit codes and reporting thresholds for continuous integration workflows.
Website: github.com/phpmd/phpmd
Support:
Developer: Manuel Pichler and contributors
License: BSD 3-Clause ‘New’ or ‘Revised’ License
PHPMD is written in PHP. Learn PHP with our recommended free books and free tutorials.
Related Software
| PHP Linters | |
|---|---|
| PHPStan | PHP static analysis tool |
| PHP Coding Standards Fixer | Fixes your code to follow the standards |
| Mago | Extremely fast PHP linter, formatter, and static analyzer |
| Psalm | Static analysis tool |
| Phan | Static analyzer for PHP |
| PHP_CodeSniffer | Tokenizes PHP files and detects violations |
| Deptrac | Static code analysis tool for PHP projects |
| PHP Parallel Lint | Checks the syntax of PHP files in parallel |
| PHPLint | Speed up linting PHP files |
| PHPCompatibility | Coding standard for PHP_CodeSniffer |
| PHPArkitect | Define architectural rules as executable PHP code |
Read our verdict in the software roundup.
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |


Please read our Comment Policy before commenting.