Priti's Technical Corner

October 21, 2016

phpmd for code review

Hello Friends,

I use phpmd for code reviews. It is quick and easy to setup. Provides me first hand information about sub optimal code, over complicated experssion,Unused parameters, methods, properties and suggestions for refactoring class and functions.

Install phpmd

Add in your composer.json of your project

“require-dev”: {

“phpmd/phpmd” : “@stable”


Command prompt >phpmd /path/to/directory/for/php/class text

You may get following error sometimes

‘phpmd’ is not recognized as  internal or external command

on command prompt run

> composer global require phpmd/phpmd

Mandatory arguments:

1) A php source code filename or directory. Can be a comma-separated string

2) A report format (It can be Text, Html, XML)

3) A ruleset filename or a comma-separated string of ruleset filenames

Available rulesets: cleancode, codesize, controversial, design, naming, unusedcode.

Optional arguments 

  • minimumpriority: rule priority threshold; rules with lower priority than this will not be used
  • reportfile: send report output to a file; default to STDOUT
  • suffixes: comma-separated string of valid source code filename extensions, e.g. php,phtml
  • exclude: comma-separated string of patterns that are used to ignore directories
  • strict: also report those nodes with a @SuppressWarnings annotation

Rule set for PHPMD

To dump phpmd output in a file

On command prompt

phpmd C:\wamp64\www\myproject\models text –reportfile anyfilename.txt  unusedcode, controversial, codesize, cleancode

The interesting thing is you can define the rules as per your projects. An easy CLI tool to keep code neat and clean.

Happy Coding !

August 19, 2016

Responsive Tribute Page

Filed under: Frontend — Tags: — pritisolanki @ 8:20 pm

Today I have uploaded a tribute page sample on my github.

Have a look !

Please drop of your suggestions and issues if you find some.

Thank you


Older Posts »

Create a free website or blog at

%d bloggers like this: