\\n\"\n}\n[/block]\n\n\n**Language / Framework:**PHP \n**Checks:** 40 \n**Categories:** Clarity, Style, Bug Risk, Compatibility \n**PHPMD Version:** 2.10.3\n\n[PHPMD](https://github.com/codeclimate/codeclimate-phpmd) looks for several potential problems within PHP source code, like possible bugs, suboptimal code, overcomplicated expressions, and unused parameters, methods, or properties.\n\n## Enable the Plugin\n\nTo enable PHPMD analysis, add the following to your `.codeclimate.yml` configuration file:\n\n```yaml\nplugins:\n phpmd:\n enabled: true\n```\n\n**More information about the CLI is available in the README here: **\n\n## Configure the Plugin\n\n## Extensions\n\nYou can specify which file extensions you'd like our PHPMD engine to analyze by adding a `file_extensions` key nested under an engine `config` key in your .codeclimate.yml:\n\n```yaml .codeclimate.yml\nplugins:\n phpmd:\n enabled: true\n config:\n file_extensions: \n - php\n - inc\n```\n\n## Rulesets\n\n[PHP Mess Detector](https://github.com/phpmd/phpmd) offers a variety of checks for your PHP code, including:\n\n- [cleancode](http://phpmd.org/rules/cleancode.html)\n- [codesize](http://phpmd.org/rules/codesize.html)\n- [controversial](http://phpmd.org/rules/controversial.html)\n- [design](http://phpmd.org/rules/design.html)\n- [naming](http://phpmd.org/rules/naming.html)\n- [unusedcode](http://phpmd.org/rules/unusedcode.html)\n\nYou can configure our PHPMD engine to use the rulesets most valuable to your team, and also provide paths to custom rulesets:\n\n```yaml .codeclimate.yml\nplugins:\n phpmd:\n enabled: true\n config:\n file_extensions: \"php\"\n rulesets: \"unusedcode,codesize,naming,optional_relative_path_to_custom_ruleset.xml\"\n```\n\nIf no rulesets are specified in your .codeclimate.yml, our PHPMD engine by default includes checks from all six of the above rulesets.\n\n## Configuring Thresholds\n\nStandard PHPMD checks come set up with certain thresholds by default. To adjust these, add a custom ruleset that includes the PHPMD ruleset of interest, and excludes the rules for which you'd like to set custom values. Add these rules in the same `.xml` ruleset file separately. \n\nFor instance, to set the `codesize`ruleset's `TooManyPublicMethods` to 25, add a custom ruleset.xml that includes the `codesize` ruleset excluding that rule, then lists the `TooManyPublicMethods` rule separately with the desired value.\n\n```xml myRuleset.xml\n\n\n Custom rules for checking my project\n \n \n \n \n\n \n \n \n \n \n\n```\n\nIn your `.codeclimate.yml` config under the phpmd engine rulesets, include the path to this custom ruleset file only, and omit the `codesize` ruleset. This step is important because PHPMD rulesets are additive.\n\n```text\nplugins:\n phpmd:\n enabled: true\n config:\n file_extensions: \n - php\n - inc\n rulesets: \"unusedcode,naming,myRuleset.xml\"\n```\n\n## Understand the Plugin\n\nFor more information about all the checks available and their configuration options, please check out the documentation here: ","order":34,"isReference":false,"deprecated":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"reusableContent":[],"previousSlug":"","slugUpdatedAt":"2025-04-30T00:22:53.729Z","revision":3,"_id":"57e17235463a9120006d6f76","parentDoc":null,"version":"57e17235463a9120006d6e7f","__v":2,"createdAt":"2015-11-24T20:45:14.682Z","user":"6802655ea0c31b0038c71658","category":"57e17235463a9120006d6e81","githubsync":"","project":"57e17235463a9120006d6e7d","updatedAt":"2025-04-30T15:47:26.216Z","pendingAlgoliaPublish":false,"lastUpdatedHash":"cf2f7f6544f73d6939e8220e70c1c0e93599b4b3","isApi":false,"id":"57e17235463a9120006d6f76"},"meta":{"slug":"phpmd","type":"docs","parent":null,"image":[],"title":"PHP Mess Detector","title_seo":"PHP Mess Detector","description":"⚠️ Code Climate Quality is being replaced with Qlty Cloud — New users should sign up directly at qlty.sh.— To migrate an existing account, please see our Migration Guide. Language / Framework:PHPChecks: 40Categories: Clarity, Style, Bug Risk, CompatibilityPHPMD Version: 2.10.3 PHPMD looks for severa...","_id":"57e17235463a9120006d6f76","hidden":false},"config":{"algoliaIndex":"readme_search_v2","amplitude":{"apiKey":"dc8065a65ef83d6ad23e37aaf014fc84","enabled":true},"asset_url":"https://cdn.readme.io","domain":"readme.io","domainFull":"https://dash.readme.com","encryptedLocalStorageKey":"ekfls-2025-03-27","fullstory":{"enabled":true,"orgId":"FSV9A"},"metrics":{"billingCronEnabled":"true","dashUrl":"https://m.readme.io","defaultUrl":"https://m.readme.io","exportMaxRetries":12,"wsUrl":"wss://m.readme.io"},"proxyUrl":"https://try.readme.io","readmeRecaptchaSiteKey":"6LesVBYpAAAAAESOCHOyo2kF9SZXPVb54Nwf3i2x","releaseVersion":"5.394.0","sentry":{"dsn":"https://3bbe57a973254129bcb93e47dc0cc46f@o343074.ingest.sentry.io/2052166","enabled":true},"shMigration":{"promoVideo":"","forceWaitlist":false,"migrationPreview":false},"sslBaseDomain":"readmessl.com","sslGenerationService":"ssl.readmessl.com","stripePk":"pk_live_5103PML2qXbDukVh7GDAkQoR4NSuLqy8idd5xtdm9407XdPR6o3bo663C1ruEGhXJjpnb2YCpj8EU1UvQYanuCjtr00t1DRCf2a","superHub":{"newProjectsEnabled":true},"wootric":{"accountToken":"NPS-122b75a4","enabled":true}},"context":{"labs":{},"user":{},"terms":[],"variables":{"user":{},"defaults":[]},"project":{"_id":"57e17235463a9120006d6e7d","appearance":{"hideTableOfContents":false,"javascript":"","showVersion":true,"header":{"img_pos":"tl","img_size":"auto","img":[],"style":"solid","linkStyle":"buttons"},"hide_logo":true,"html_footer":"","logo":["https://files.readme.io/XZInkgKTAerd7E4rjoUh_code-climate-logo.png","code-climate-logo.png","280","80","#241c24","https://files.readme.io/2ElCNFp1SWLds6tdHhFX_code-climate-logo.png"],"promos":[{"extras":{"type":"html","buttonPrimary":"get-started","buttonSecondary":""},"title":"Code Climate Quality Documentation","text":"","_id":"5653462e0672922b003be690"}],"html_footer_meta":"","html_promo":"\n
\n \n\n
\n \n
\n ⚠️\n Code Climate Quality is being replaced with Qlty Cloud\n
\n \n
\n
\n — New users should sign up directly at qlty.sh\n
\n
\n — To migrate an existing account, please see our Migration Guide\n
\n
\n \n
\n\n\n
\n
\n
\n\n\n Need help with Code Climate Quality?Look no further.\n