PHP Mass Detector and Codefixer in Laravel

22 Oct 2016

List of code refactoring tools:

  1. PHPMD
  2. PHP CodeSniffer
  3. PHP Codefixer

I install above script for specific project via Composer:

composer require fabpot/php-cs-fixer
composer require phpmd/phpmd@stable
composer require fabpot/php-cs-fixer

From the laravel project directory, run these command

./vendor/bin/phpmd app html cleancode,codesize,unusedcode,naming --reportfile phpmd-report.html

PHP Code beautiful ./vendor/bin/phpcbf app –standard=PSR2 –report=diff -vv ./vendor/bin/phpcs app –report-csv=phpcs.csv

PHP Codefixer

./vendor/bin/php-cs-fixer fix app --level=psr2 --fixers=linefeed,short_tag,indentation,unused_use,no_useless_return,ordered_use,return

Tweet me @huynhbathanh if you like this post.

Tweet
comments powered by Disqus