Skip to content

Instantly share code, notes, and snippets.

@hassanjamal
Created October 3, 2017 10:23
Show Gist options
  • Save hassanjamal/c868f8808c06c4acfcf717c0b5bb01e1 to your computer and use it in GitHub Desktop.
Save hassanjamal/c868f8808c06c4acfcf717c0b5bb01e1 to your computer and use it in GitHub Desktop.
How to install PHP code inspection tools using homebrew-php and how to integrate with JetBrain's IntelliJ or PhpStorm

#Inspection Tools with homebrew-php#

##Prerequisites##

  • Homebrew is installed

##Step 1: Installing homebrew-php##

  1. brew tap homebrew/dupes
  2. brew tap josegonzalez/homebrew-php
  3. brew install PHP53 (or other version of your choice)

##Step 2: Installing PHP Code Sniffer##

  1. brew install php-code-sniffer
  2. brew install phpcs

###Integration with IntelliJ IDEA or PhpStorm###

  1. Navigate to Preferences > PHP > Code Sniffer
  2. Set path to output of which phpcs and hit 'validate'
  3. Navigate to Preferences > Inspections > PHP > PHP Code Sniffer validation and tick to enable
  4. Refresh 'Coding Standards' dropdown and select your preferred options

##Step 3: Installing PHP Mess Detector##

  1. brew install phpmd

###Integration with IntelliJ IDEA or PhpStorm###

  1. Navigate to Preferences > PHP > Mess Detector
  2. Set path to output of which phpmd and hit 'validate'
  3. Navigate to Preferences > Inspections > PHP and tick to enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment