JetBrains PhpStorm is a commercial PHP IDE that you can configure to work with your Drupal sites. For detailed information, see Drupal Development Using PhpStorm and Developing on Pantheon with PhpStorm.
This article covers some best practices and recommendations for building a Drupal site on Pantheon using PhpStorm.
Initial Site Setup
After you've created your site on Pantheon, you'll need to 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
- Open PhpStorm and create a new project from existing files.
- Choose the project directory.
- Select the parent folder for all the project sources and click the icon, or choose Project Root on the menu.
- Click Finish.
Configure a PhpStorm Project
- Ensure that PhpStorm uses Drupal settings by going to Preferences > Drupal.
- Enable Drupal integration and select the Drupal installation path.
- Set up PHP/Include Paths.
- Choose the Drupal major version.
- Configure the correct version of PHP by going to Preferences > PHP, and choose PHP Language Level 5.3.
We recommend enabling Drush support.
- From Preferences > Command Line Tool Support, click Plus.
- Choose Tool > Drush, and specify the path.
Configure On-Server Development
- Put your Dev environment into SFTP mode, and click Connection Info to see the connection settings.
- Within PhpStorm, go to Tools > Deployment > Configuration.
- Click plus for the add server dialog.
- Enter the Pantheon site name followed by a dash and the environment.
- Type SFTP and click OK.
Configure the server connection tab in the following order:
- SFTP Host: SFTP Host from Connection Info
- Port: 2222
- Username: Username from Connection Info
- Auth Type: Key Pair
- Private Key File: Navigate to the location of your id_rsa file. Example: /Users/jon/.ssh/id_rsa
- Click Test SFTP Connection...
- Root Path: Click Autodetect, and navigate to the end of the detected path and add /code to the end
- Deployment path on server: /code
- Web path on server: URL of your Pantheon Dev environment. Example: https://dev-yoursite.pantheonsite.io
- Click OK.
- Go to Tools > Deployment > Automatic Upload > and select the server you created.
Now any files you change and save locally will be automatically uploaded to Pantheon.