Forrest logo
back to the phpmd tool

phpmd:tldr:f767d

phpmd: Output the results to a file instead of `stdout`.
$ phpmd ${filename_or_directory} ${xml|text|html} ${rulesets} --reportfile ${path-to-report_file}
try on your machine

This command runs the PHP Mess Detector (PHPMD) tool on a specific file or directory with provided rulesets and generates a report in the specified format.

Here is a breakdown of the command:

  • phpmd: This is the command to run the PHP Mess Detector tool.

  • ${filename_or_directory}: This is a placeholder for the name of a specific file or directory that you want to analyze using PHPMD. Replace it with the actual file or directory name.

  • ${xml|text|html}: This is another placeholder where you can specify the format for the generated report. You have three options to choose from: XML, text, or HTML. Replace it with either xml, text, or html depending on the desired format.

  • ${rulesets}: This is a placeholder for specifying one or more rulesets for PHPMD to use during the analysis. Rulesets define the rules and configurations to be applied during the analysis. You can provide the name of a predefined ruleset, a comma-separated list of rulesets, or a ruleset file path.

  • --reportfile ${path-to-report_file}: This flag specifies the path and filename where the generated report will be saved. Replace ${path-to-report_file} with the desired location and filename for the report file.

By executing this command, PHPMD will analyze the specified file or directory using the given rulesets, generate a report in the specified format, and save it in the specified path and filename.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the phpmd tool