Sourcify
Effortlessly find and manage open-source dependencies for your projects.

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.
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.
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."
Post questions, share tips, and help other users.
Effortlessly find and manage open-source dependencies for your projects.

End-to-end typesafe APIs made easy.

Page speed monitoring with Lighthouse, focusing on user experience metrics and data visualization.

Topcoder is a pioneer in crowdsourcing, connecting businesses with a global talent network to solve technical challenges.

Explore millions of Discord Bots and Discord Apps.

Build internal tools 10x faster with an open-source low-code platform.

Open-source RAG evaluation tool for assessing accuracy, context quality, and latency of RAG systems.

AI-powered synthetic data generation for software and AI development, ensuring compliance and accelerating engineering velocity.