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.
After you've created your site on Pantheon, you'll need to set up your local environment.
Make sure your Dev environment is in Git mode, then clone your Git repository to your local workstation.
Open PhpStorm and create a new project from existing files.
From the Create New Project: Choose Your Scenario, window select Source files are in a local directory, no Web server is yet configured, then click next:
Choose the project directory.
Select the parent folder for all the project sources and click the Project Root icon, or choose Project Root on the menu.
Ensure that PhpStorm uses Drupal settings by going to Preferences > Languages & Frameworks > PHP.
Expand the Drupal dropdown.
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 > Languages & Frameworks > PHP, and choose PHP Language Level 5.3.
We recommend enabling Drush support.
From Preferences > Tools > Command Line Tool Support, click Plus.
Choose Tool > Drush, and specify the path.
Put your Dev environment into SFTP mode, and click Connection Info to see the connection settings.
Within PhpStorm, go to Build, Execution, Deployment > Deployment.
Click plus for the add server dialog, and choose SFTP
Enter the Pantheon site name followed by a dash and the environment. For example,
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
- Click Test SFTP Connection...
- Root Path: Click Autodetect, then navigate to the end of the detected path and add
/codeto the end
Deployment path on server:
Web path on server: URL of your Pantheon Dev environment. Example:
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.