phpmd/phpmd
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
composer/xdebug-handler | 3.0.5 | - | MIT | prod | |
pdepend/pdepend | 2.16.2 | 550.9 kB | BSD-3-Clause | prod |
PHPMD, the PHP equivalent of the well-known Java tool PMD, is a user-friendly frontend application that measures the raw metrics stream of your PHP code. As a spin-off project of PHP Depend, it offers the functionality to provide insights into potential issues with your PHP code such as possible bugs, dead code, suboptimal or overcomplicated code, and more. The goal is to help you create better, more manageable, and more robust PHP code.
To utilize the functionality of PHPMD, you need to install it and run it via the command line. The basic command line usage would look like this:
phpmd [filename|directory[,filename|directory[,...]]] [report format] [ruleset file]
The example in the given readme is:
phpmd php/PDepend/DbusUI/ xml rulesets.xml
In this context, php/PDepend/DBusUI/
refers to the targeted directory, xml
is the report format, and rulesets.xml
is your ruleset file. You can provide multiple directories or filenames separated by comma. PHPMD also accepts various optional command-line arguments such as --verbose
, --minimumpriority
, --reportfile
, etc.
For instance, If you want to use the built-in codesize
rule and generate a report named phpmd.xml
, you would execute the command as follows:
phpmd PHP/Depend/DbusUI xml codesize --reportfile "phpmd.xml"
You can even configure your own combination of rule sets. PHPMD allows you to use multiple rule sets, built-in sets, and even custom rule set files. Here's an example of how you can use multiple rule sets and custom rule set files:
phpmd /path/to/source text codesize,/my/rules.xml
The PHPMD documentation can be found on the official website, phpmd.org. It contains comprehensive guidelines on how to utilize the tool effectively, how to set up different rule sets, and more details about its functions and features. For users looking to contribute to the project, there's a contribution guide linked within the GitHub repository's readme.