Drupal Development using PhpStorm

Beginning from latest Early Access Program for PhpStorm 7, the IDE now bundles Drupal Plugin providing many Drupal-specific features for Drupal 7 and 6, some of which work for Drupal 8 as well.

Watch out the video tutorial below, or check a full text tutorial on Drupal Development using PhpStorm in our PhpStorm tutorial space.

Drupal Plugin provides functionality for modules, themes as well as for core Drupal development:

Enabling Drupal Integration in an Existing PhpStorm Project, or Creating a New Drupal Module

When the project you’re working on is recognized as a Drupal Module, you will be offered the ability to enable support for Drupal automatically with a popup and event in the Event Log.

In the dialog box, you need to provide some additional information for the Drupal Installation Path and version number (currently 6 and 7 are supported). Select Set up PHP | Include paths to automatically configure include paths for the project.

A new Drupal module can be created from the Welcome screen or by selecting File | New Project. Initial files in the project will be created automatically (.module and .info files).

Development Environment Auto-Configuration

Whether you enable Drupal support in an existing PhpStorm project or create a new Drupal Module, the IDE checks if the development environment is configured properly for Drupal development. If the configuration does not meet the requirements, pop-ups with a fix suggestion will appear, as well as Event Log events. To fix these issues just click the Fix link.

Auto-configuration is provided for Include Paths, File Associations (.module, .install, .info), Drupal Coding Standards.

Drupal Hooks Support (provided in .module files only)

Completion for Hook Declaration

Any hook invocations are indexed by the IDE, and hook names become available in code completion with Ctrl+Space (Cmd-Space on Mac OS X) for creating hook implementations.

Navigation to Hook Invocations from the Gutter

Navigation to any Drupal Hook is possible from the editor gutter with the ‘navigate to hook invocation’ icon: 

Quick Documentation for Hook Declaration

Quick documentation for Drupal Hook can be viewed right in the IDE with View | Quick Documentation (or just by pressing F1). Documentation is taken from .api.php files provided by core and many other modules for reference purposes.

Drupal Command Line Tool Drush Integration

Drush is a command line shell and scripting interface for Drupal. PhpStorm’s command line tool supports Drush 5.8 and higher versions.

Search in Drupal API Right from the Editor

Drupal API Documentation at https://api.drupal.org/api/drupal can be easily reached from the IDE with symbol search. Just select the symbol you are interested in, invoke the context menu in the editor, and then select Search in Drupal API.

Drupal Issue Tracker Integration

Drupal.org Issue Tracker can be integrated in PhpStorm as a Generic issue tracker providing commit message generation, tasks switching in the IDE, and more. Authorisation in the Drupal.org issue tracker is not supported, so the information we can get is limited to that available to anonymous users.

Please check our detailed tutorial on Integration with an Issue Tracking System in PhpStorm and Integrating PhpStorm and the Drupal.org Issue Queue blog post by Cameron Eagans with detailed information on Drupal.org issue tracker configuration.

Issue Tracker Integration configuration is available in Settings | Tasks | Servers.

Debugging and Profiling Drupal Applications with PhpStorm

Drupal-based projects can be debugged and profiled without any Drupal-specific configuration. Please proceed with standard PhpStorm debugging or profiling workflow.

Check a full version of tutorial on Drupal Development using PhpStorm in our PhpStorm tutorial space.

Give Drupal Plugin in latest PhpStorm 7 EAP a try and let us hear your thoughts in the issue tracker, comments below or in our forums!

Develop with pleasure!
– JetBrains PhpStorm Team

This entry was posted in Cool Feature and tagged , , , , . Bookmark the permalink.
  • Andrew

    Hey! When’s the next discout sale? I want to buy PhpStorm cheaper :)))

    • Ronald

      Which basicly mean: I like your effort but I don’t want to pay your already small price. @Andrew: just wait and wait. Gives others the advantage. :-p

  • http://www.piotr.rybaltowski.com/ Piotrek R.

    Nice! But why it’s 7.0 and not some 6.1? Is it really such a major update or you’re just following the version-number race?

    • Mikhail Vink

      PhpStorm 7.0 is a major update, and it’s not only about Drupal plugin. More is coming!

  • elkuku

    Honestly I prefer my OOP… but great news for the Drupal guys 😉

    • Dave

      I guess you have’t taken a look at Drupal 8 recently…

  • http://blog.lixiphp.com/ lixiphp

    Thanks, apply the article to Chinese Version (PHPStorm Drupal集成与开发) http://blog.lixiphp.com/phpstorm-drupal-development/

  • http://nerdery.com Chris Weber

    This looks great, I’m currently trying out the EAP of phpstorm and am having trouble getting this functionality to work for projects that have the entire drupal site as it’s root.

    Do you intend this functionality to only work for specific folders within a drupal codebase?

    • Mikhail Vink

      In general this functionality is geared towards module development (and it’s advised to develop these modules in separate per-module folders), however all the features can be enabled anyway (but auto-fixes wouldn’t be offered) – are there any specific features you have problems with? Could you please describe your workflow?


      • https://drupal.org/user/240860 Ted Bowman

        I am also using the EAP of phpstorm 7. I have been able to get these Drupal features by making the root of the Drupal install the PHPStorm project and then adding Drupal support in the preferences where I select the same root folder as the Drupal install. Do you know of any drawbacks to this method?

        I think I probably have a similar use case with Chris. I am often working on a client’s project where there might be a few custom modules. It wouldn’t make sense to make a separate PHPStorm project for each custom module folder. The whole Drupal install is 1 git repository.

        I also would want to see this integration on the modules that aren’t custom, for instance if I have to debug contrib or core modules.

        The only use case I would see where I would make a separate PHPStorm project of an individual module is if I was working on one of my own contributed modules. I know for me though when I am doing “module development” it is more often in the context of custom module for client as described above.

        I think though there are other drawbacks to using the module folder as your base folder in the phpStorm Drupal project. Most importantly this doesn’t give you easy access to other contributed modules. Almost always in Drupal module development you are integrating with other contrib modules not just core.

        If I use the module folder “mymodule”(which is at drupal_root/sites/all/modules/custom) as the phpstorm project and add the Drupal support then phpStorm will add the folders:


        So therefore PHPStorm would have not information about functions of any modules under:


        I know I could add these myself but would there be any problem with having the project folder itself under the “external libraries”

        • Mikhail Vink

          It seems that the issue about folders has been already resolved in latest EAP – there was a problem about including these modules you mentioned (subdirectories of modules folder) – http://youtrack.jetbrains.com/issue/WI-19251

          In general there shouldn’t be any drawbacks about enabling integration for a whole drupal folder – it just should work. If there are any – please report us at http://youtrack.jetbrains.com/issues/WI

  • https://drupal.org/user/240860 Ted Bowman

    Just trying to offer feedback and give an example of how it is being used. I really do like what you have done with the Drupal integration!

  • https://drupal.org/user/240860 Ted Bowman

    In the video above when he demos the hook function completion, around 2:40, it only completes the name of the of function.

    It would great if you added native support of Drupal Live templates. I am currently using the live templates found here: https://drupal.org/project/phpstorm-templates

    They work great for PHPStorm 6 and give you stub function as well as the correct PHPDoc block to start with.

  • Dio

    Great news! Do you know when all this goodness will make its way to the PHP plugin that I use on IntelliJ? I use IntelliJ with plugins to code in Java, Python, PHP and Ruby, so using any of the language specific JetBrains IDEs would be overkill.

    • http://randell.ph/ Randell

      Same here. I still don’t get it why Jetbrains can’t just make those changes from PhpStorm work out-of-the-box for IntelliJ as plugins.

      • Mikhail Vink

        Some changes already works with latest IntelliJ IDEA 13 EAP. Drupal features will be added soon, but definitely before release of IntelliJ IDEA 13.

  • http://orange949.com/web-development-miami Orange949

    Thank you for sharing such nice information. Everyone Please advise me, How to install php interpreter in phpstorm?

  • Donny

    Hi Jetbrains!

    When will there be more support for Drupal 8?

    • Maxim Kolmakov

      What would you like to see?