Skip to main content
Last Reviewed: January 31, 2020

Configure PhpStorm for Drupal

Configure your local environment to build a Drupal module with JetBrains PhpStorm.


This section provides information on how to configure your local environment to build Drupal modules with JetBrains PhpStorm.

Refer to Drupal Development Using PhpStorm and Developing on Pantheon with PhpStorm for more information.

Initial Site Setup

Create your site on Pantheon if you haven't already, and then set up your local environment.

Clone the Code Repository

Make sure your Dev environment is in Git mode, then clone your Git repository to your local workstation.

Create a New PhpStorm Project

  1. Open PhpStorm and create a new project from existing files.

  2. Open the Create New Project: Choose Your Scenario window, select Source files are in a local directory, no Web server is yet configured, and then click next:

    PHPStorm new project wizard

  3. Choose the project directory.

  4. Select the parent folder for all the project sources and click the Project Root icon, or choose Project Root on the menu.

  5. Click Finish.

Configure a PhpStorm Project

  1. Ensure that PhpStorm uses Drupal settings: go to Preferences, select Languages & Frameworks, and then select PHP.

  2. Expand the Drupal drop-down menu.

  3. Enable Drupal integration and select the Drupal installation path.

  4. Set up PHP/Include Paths.

  5. Select the Drupal major version.

  6. Configure the correct version of PHP: go to Preferences, select Languages & Frameworks, select PHP, and choose PHP Language Level with the appropriate version of PHP (e.g. 8.0).

Drush Support

We recommend enabling Drush support.

  1. Open Preferences, select Tools, select Command Line Tool Support, and then click Plus.

  2. Select Choose Tool, select Drush, and then specify the path.

    Drush Support

Configure On-Server Development

  1. Put your Dev environment into SFTP mode and then click Connection Info to see the connection settings.

  2. Open PhpStorm, select Build, select Execution, and then select Deployment.

  3. Click plus for the add server dialog, and select SFTP.

    PhpStorm on-server development settings

  4. Enter the Pantheon site name followed by a dash and the environment. For example: anita-drupal-dev

Connection Tab

Configure the server connection tab in the following order:

  1. SFTP Host: SFTP Host from Connection Info

  2. Port: 2222

  3. Username: Username from Connection Info

  4. Auth Type: Key Pair

  5. Private Key File: Navigate to the location of your id_rsa file. Example: /Users/jon/.ssh/id_rsa

  6. Click Test SFTP Connection...

  7. Root Path: Click Autodetect, navigate to the end of the detected path and add /code to the end.

Mappings Tab

  1. Deployment path on server: /code

  2. Web path on server: URL of your Pantheon Dev environment. Example: https://dev-anita-drupal.pantheonsite.io

  3. Click OK.

  4. Go to Tools, select Deployment, select Automatic Upload, and then select the server you created.

Files you change and save locally will now be automatically uploaded to Pantheon.

More Resources