Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including grunt-phpmd with all npm packages installed. Try it out:

var gruntPhpmd = require("grunt-phpmd")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

grunt-phpmd v0.1.1

Grunt plugin for running PHP Mess Detector.


Grunt plugin for running PHP Mess Detector.

This plugin is developed for Grunt 0.4.0 and is not tested for backward compatibility with Grunt 0.3.x.

Getting Started

  1. Install this grunt plugin with the follwing command:
npm install grunt-phpmd --save-dev
  1. Install PHPMD

  2. Add this to your project's Gruntfile.js:


PHPMD task

Run this task with the grunt phpmd command.

This task is a multi task so any targets, files and options should be specified according to the multi task documentation.

Usage Example

phpmd: {
  application: {
      dir: 'application'
    options: {
      rulesets: 'codesize'

Target Properties


Type: String

The file or directory where phpmd should search for files.



Type: String Default: 'phpmd'

The binary name if it is in your PATH or the full path if not.


Type: String Default: 'xml'

The type of report to generate. PHPMD supports xml, text and html.


Type: String Default: false

Set a path and filename here to write to a file, otherwise it will write to stdout.


Type: String Default: false

Set a comma-separated string of valid source code filename extensions.


Type: String Default: false

Set a comma-separated string of patterns that are used to ignore directories.


Type: Number Default: false

Rule priority threshold: rules with lower priority than this will not be used.


Type: Boolean Default: false

Also report those nodes with a @SuppressWarnings annotation.


Type: String Default: 'codesize,unusedcode,naming'

A ruleset filename or a comma-separated string of rulesetfilenames. Make sure to have no spaces between the items!


Type: Number Default: 200*1024

Override the maxBuffer-Size of nodejs's exec() function if you expect a long output on stdout.


Type: Boolean Default: false

Option to ignore error code 2 from phpmd and don't treat it as grunt fatal


Type: Boolean Default: true

Option to ignore warning code 1 from phpmd and don't treat it as grunt warn


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free