Skip to content

Instantly share code, notes, and snippets.

@M4R14
Forked from hassanjamal/php-code-inspection.md
Last active December 22, 2020 08:24
Show Gist options
  • Select an option

  • Save M4R14/d61098dcfcaa019f7b1cc2997db82998 to your computer and use it in GitHub Desktop.

Select an option

Save M4R14/d61098dcfcaa019f7b1cc2997db82998 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