Features Releases

Developing on Pantheon with PhpStorm

GetPantheon.com Drupal and WordPress hostingWhere do we host our applications? How do we deploy them? Can we have different environments like development, staging and production? A possible answer to all those questions is Pantheon. It provides hosting, database, caching, version control, different environments, workflows for moving an application through the development pipeline and more. Let’s go over the basics of working on a Drupal or WordPress site hosted on Pantheon, using PhpStorm.

If you prefer watching a quick screencast instead of reading lots of text, here you go:
https://www.youtube.com/watch?v=2K20B0cEC4g

Getting Started

Let’s assume a site has already been created on Pantheon. We can work on the site’s sources in two ways: using Git, developing locally and pushing changes to Pantheon once we want them to go live. The other way of working is using SFTP where we deploy our changes on the Pantheon servers directly, either manually or automatically. PhpStorm supports both modes, but for this blog post let’s stick with Git.

Using VCS | Checkout from Version Control | Git, we can enter our Pantheon’s Git repository details, which we can find on our site’s dashboard.

Clone Git repository from Pantheon

After selecting the path to clone into, PhpStorm prompts for our Pantheon password and then clones the entire site to our system. After cloning the site’s sources, PhpStorm will detect the framework we’re using and lets us enable support for Drupal or WordPress.

Drupal and WordPress support

Once enabled, we can start working on our application’s code!

Deploying Changes to Pantheon

After modifying our source code, for example working on a Drupal or WordPress plugin, we can commit our changes back to Pantheon’s servers. Using the Ctrl+K keyboard shortcut (CMD+K on Mac OS X), PhpStorm lets us review the changes we made and add a description to the commit.

Commit Changes to Pantheon

The Commit and Push command uploads our changes and displays them on the Pantheon site dashboard. Changes are now live in our development site, and we can use Pantheon’s workflows to advance it to a testing environment, staging or production.

Pantheon Commit Log

What else is there?

This blog post only covered the basics. We can do many more things, like working with the hosted database directly, database refactoring and code completion. Drush, Drupal’s command line too, can be used to perform actions related to our application and even Pantheon-specific actions using Terminus. A complete tutorial on developing a Drupal or WordPress application using Pantheon and PhpStorm is available.

Give it a go! We would love to hear from you through the issue tracker, in the comments below, or in our forums!

Develop with pleasure!
– JetBrains PhpStorm Team

image description