
MegaLinter
The ultimate open-source orchestration tool for code quality, security, and consistent delivery.

The industry-standard PHP static analyzer for detecting code smells, complexity, and over-engineered architecture.
The industry-standard PHP static analyzer for detecting code smells, complexity, and over-engineered architecture.
PHPMD (PHP Mess Detector) is a mature, high-performance static analysis tool designed to identify potential problems within PHP source code. Functioning as a PHP-equivalent to the Java tool PMD, it utilizes the PDepend engine to parse source files and apply a series of sophisticated rule-sets. In the 2026 landscape, PHPMD remains a critical component of the PHP ecosystem, positioned as the middle-layer of quality assurance between basic linting (PHP_CodeSniffer) and deep formal verification (PHPStan/Psalm). Its primary value proposition lies in its ability to detect 'soft' architectural failures—such as high Cyclomatic Complexity, N-Path Complexity, and the 'God Object' anti-pattern—which automated testing often misses. The tool is highly extensible, allowing engineering leads to define custom XML rulesets that enforce organizational coding standards. Architecturally, it operates via a Command Line Interface (CLI), making it natively compatible with modern containerized CI/CD pipelines. By 2026, its integration with AI-driven refactoring agents has solidified its role, providing the objective metrics required for AI to suggest safe code transformations without increasing technical debt.
The industry-standard PHP static analyzer for detecting code smells, complexity, and over-engineered architecture.
Quick visual proof for PHPMD - PHP Mess Detector. Helps non-technical users understand the interface faster.
PHPMD (PHP Mess Detector) is a mature, high-performance static analysis tool designed to identify potential problems within PHP source code.
Explore all tools that specialize in detect code smells. This domain focus ensures PHPMD - PHP Mess Detector delivers optimized results for this specific requirement.
Explore all tools that specialize in complexity analysis. This domain focus ensures PHPMD - PHP Mess Detector delivers optimized results for this specific requirement.
Open side-by-side comparison first, then move to deeper alternatives guidance.
Calculates the number of linearly independent paths through a program's source code using the PDepend engine.
Measures the number of acyclic execution paths through a method, providing a deeper look than standard CC.
Detects high degrees of dependency between classes which indicates rigid architecture.
Scans for unused parameters, local variables, and private properties that clutter the memory footprint.
Includes rules for CamelCase, UpperCase, and other stylistic choices that might not be errors but affect readability.
Users can compose specific rules from different sets into a single project-wide XML file.
Allows developers to 'baseline' existing mess and only report new violations in incoming code.
Install PHPMD via Composer using 'composer require --dev phpmd/phpmd'.
Verify installation by running './vendor/bin/phpmd --version' in the terminal.
Identify the target source directory (e.g., 'src') and the desired output format.
Select built-in rulesets such as 'cleancode', 'codesize', 'controversial', 'design', 'naming', or 'unusedcode'.
Execute a baseline scan: 'phpmd src/ text codesize,unusedcode'.
Create a custom 'ruleset.xml' file to tailor thresholds for Cyclomatic Complexity.
Configure file exclusions using the '--exclude' flag for vendor or cache directories.
Integrate the PHPMD command into the pre-commit hook or CI pipeline configuration.
Set up automated reporting to output XML for consumption by tools like SonarQube.
Review generated reports to prioritize refactoring of 'Hotspots' with high complexity scores.
All Set
Ready to go
Verified feedback from other users.
“Users praise PHPMD for its speed and reliability in identifying structural issues, though some find the configuration for custom rulesets to be steep for beginners.”
No reviews yet. Be the first to rate this tool.

The ultimate open-source orchestration tool for code quality, security, and consistent delivery.

Automated code reviews designed for security and speed, leveraging AI to enhance developer velocity and code quality.

Master complex codebases instantly with AI-driven contextual explanations and semantic intelligence.

Enterprise-grade static analysis and automated code review powered by the Rosie engine.

AI-powered code understanding and documentation to supercharge engineering workflows.

Advanced linter for better code quality and stronger security in your IDE.