Skip to content

Instantly share code, notes, and snippets.

@ev3rywh3re
Forked from hassanjamal/php-code-inspection.md
Created March 22, 2020 14:41
Show Gist options
  • Save ev3rywh3re/c2b38bf9eacb64bf9a477f83e49798b9 to your computer and use it in GitHub Desktop.
Save ev3rywh3re/c2b38bf9eacb64bf9a477f83e49798b9 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