Drupal and PHPStorm setup

To unlock the real value of PHPStorm in your Drupal project

Setup the PHPStorm local IDE on Mac for Drupal project

  1. Install PHPCS globally composer global require squizlabs/php_codesniffer
  2. Execute nano ~/.zshrc then add this line export PATH="$HOME/.composer/vendor/bin:$PATH" At the end of this file and save. And then read it again as a source source ~/.zshrc. (THIS IS APPLICABLE IF YOU ARE USING ZSH)
  3. Make sure the PHPCS command is installed and working fine now by executing which phpcs
  4. Install Drupal coding standard extension composer global require drupal/coder and then composer global require dealerdirect/phpcodesniffer-composer-installer
  5. Enable Drupal integration. Open PHPStorm. Goto Preferences. Go to PHP then Frameworks And enable Drupal and set the right folder path. (or search for drupal in the list for quick access)
  6. On PHPStorm. Click File menu and click Invalidate Cache.. and check all the options. To re-index the project.

Share this post