Drupal, PhpStorm, and PHPCS quick-start


  • Composer
  • PhpStorm

Let’s go!

1. Composer + Settings

Run the following in your terminal:

  • composer global require squizlabs/php_codesniffer:2.9.1
  • composer global require drupal/coder
  • phpcs –config-set installed_paths ~/.composer/vendor/drupal/coder/coder_sniffer

2. Configure PhpStorm

Open PhpStorm preferences (⌘,) and go to the Code Sniffer settings. Click the “…” button.Enter the path to your “phpcs” file and click “Validate”. It should be ~/.composer/vendor/squizlabs/php_codesniffer/scripts/phpcs (replace “~” with your actual home directory) Go back to the PhpStorm preferences, navigate to “Editor » Inspections”, enable “PHP Code Sniffer validation”, then choose “Drupal” in the “Coding standard” dropdown. Enjoy!