Theming
Topic

PhpStorm for Drupal 7, 8, 9, 10, and 11

Navigating the codebase of a Drupal project can be a tricky task. Using an integrated development environment (IDE) like PhpStorm can really help simplify many of these common tasks. PhpStorm, in particular, has excellent support for Drupal projects including code completion, syntax checking, and integration with things like version control systems and debugging tools.

Example tasks

  • More efficiently traverse the class hierarchies in Drupal
  • Manage the version control status of your code from within your editor
  • Avoid several types of bugs and mistakes thanks to the parameter hints and syntax checking provided by the IDE

Confidence

PHPStorm uses a subscription pricing model, so they are always releasing new features. They are also quite good at updating their documentation and tutorials to ensure their accuracy with the latest version. The best source of documentation is on the JetBrains website. See the "External resources" below for links.

Drupalize.Me resources

Posted on Tuesday, August 3, 2021 - 08:52 by joe

Being able to execute, and step debug, Drupal's test using the PhpStorm UI makes it easier and more efficient to write tests for your projects. Learn how to configure PhpStorm to run Drupal's PHPUnit tests inside of a DDEV environment using docker-compose and a remote PHP CLI Interpreter. This setup will work for both Drupal core and your custom code.

Using DDEV with PhpStorm

If you use DDEV for your local environment, the DDEV Integration plugin allows you to use common features from within the IDE, and provides shortcuts for setting up and using Xdebug. To use it, you will need to configure PhpStorm to point to DDEV's private docker-compose executable. See DDEV's documentation, PhpStorm Setup > Prerequisite for instructions.

Guides

Not sure where to start? Our guides provide useful learning tracks for all skill levels.

Navigate guides

External resources

  • Configuring a Drupal project in PHPStorm (jetbrains.com)
    • This JetBrains docs page shows how to configure PHPStorm for Drupal projects, and Drush.
  • PhpStorm Docs & Demos (jetbrains.com)
    • This is the official documentation on the JetBrains site. It also contains links to several cheat sheets and the plugin repository so you can add even more functionality to your IDE.
  • PhpStorm Tips (phpstorm.tips)
    • This site contains a curated list of tips, accompanied by gifs demonstrating them in action.
  • PhpStorm for Drupal (drupal.org)
    • This documentation on Drupal.org will walk you through setting up a PhpStorm project specifically for Drupal. PhpStorm has built in support for Drupal projects, and this will help you get that configured properly.
  • Learn PhpStorm with PhpStorm Workshop project (blog.jetbrains.com)
    • PhpStorm ships with a project of files that contain tutorials to help you learn more about the IDE itself.