Drupal integration in PhpStorm 7

Really glad to see the Drupal integration in the latest PhpStorm 7 EAP and just started using it. Note: in the past I configured everything myself but with the new integration this is much cleaner and straight forward. That makes a lot of sense.

Here is some feedback:

  • Include-Paths: when enabling Drupal support, there are some specific include paths added automatically. I wonder if they should be extended to the following list:
    • DRUPAL_ROOT/includes
    • DRUPAL_ROOT/modules
    • DRUPAL_ROOT/sites/all/modules
    • DRUPAL_ROOT/sites/all/themes
    • DRUPAL_ROOT/sites/all/libraries
    • maybe the last 3 could be just omitted and DRUPAL_ROOT/sites/all used instead
  • Project for Module development:
    • Maintaining a lot of different modules is now great to have individual PhpStorm projects for each of them.
    • That means I have to enable Drupal support for each of them, which is no problem either.
    • My question is: how do I debug in such an environment?
      • I created a symbolic link from DRUPAL_ROOT/sites/all/modules/MYMODULE to the real module location where I'm developing it
      • That works great, both for development and for debugging
      • The problem is that when I use "Navigate to declaration" with Ctrl-B that PhpStorm then offers two options: the phsyical one and the symbolic link one. This is annoying and I haven't found a way to disable that.
      • Is there a better way to setup my environment?
  • Drupal.org as the task server:
    • I followed the instructions at http://confluence.jetbrains.com/display/PhpStorm/Drupal+Development+using+PhpStorm and wanted to integrate drupal.org as my issue tracker.
    • Problem being that the dialog box looks different in the current PhpStorm EAP and I can't figure out on how to properly setting this up.
    • The help pages do not show anything about this either.
    • Can someone please provide some guidance or can the instructions in confluence being updated?
Comment actions Permalink


and thank you for feedback.

  • Using DRUPAL_ROOT/sites/all/ as single include path is reasonable.
  • Usual workflow for cases then project and server are local, but project is not in document root, is following. Open File | Settings | Deployment and create server of type 'Local or mounted folder' and set DRUPAL_ROOT/sites/all/modules/MYMODULE as folder to upload/download project files. Also you can provide web server root URL to enable 'Show in Browser' action. On Mappings tab map your project root to '/' path on server and (optionalyl) provide web path on server. Set this server default. Now you can navigate from Deployment settings page to Options and enable autoupload with Uploaf changed files authomatically to default server: Always. Then select project root in Project view and invode Upload to <server name> action to copy files into DRUPAL_ROOT/sites/all/modules/MYMODULE.
    This setup allows you to develop in any local folder, and have all your changes copied into Drupal root automatically. Also this sever with its mappings will be used in debugging (possibly you'll have to change type of run configurations to ones '... on remote server').
  • Thank you, we'll update docs. AFAIK, Additional tab was renamed to Server configuration, and Responce Type should be set to Text now. Here are settings that worked for me:
    Sorry for ugly pictures' preview, clicking on them shows well sized pictures.
Comment actions Permalink

Hi Elena,

Thanks a lot for your feedback.

I can confirm that number 3 is now working for me too, great stuff.

Number 2 sounds interesting - but extremely complicated. Is there a chance to automate stuff like that as part of the feature "Drupal integration"? Might be worth investigating as it will give more developers a kick-start experience.


Comment actions Permalink

There are some other ways for 2, but all of them are ugly hacks. Could you please tell me, why don't you just develop inside DRUPAL_ROOT/sites/all/modules/MYMODULE? What benefints does link provide?

Comment actions Permalink

So far, I'm developing directly in the full DRUPAL-ROOT but thought that a separated approach would be more clean. Here are some of the thouhts why:

a) Performance: sometimes I'm switching projects very often during a day and loading a project with the full drupal root as part of the project and not as external library feels much slower.

b) Incoming changes: as my Drupal deployment is made of hundreds of externals itself, PhpStorm takes quite some time to check each of those external VCS links for incoming changes.

c) Overview: I have a couple dozen projects on drupal.org and many more customer projects. And I like the idea to have those projects in a development directory structure of my own which is separated from test and production environments where they get executed.

Well, all of the above I guess could also be achieved by opening the module directory only as the PhpStorm project and still handle the drupal root as an external library. However, there are two more which may be compelling:

d) The .idea directory of the module project: if that is somewhere deep in the tree of a drupal deployment then it may get lost or becomes redundant if the same module is used and tested in two different drupal trees.

e) If a project not only includes a module but also a theme and a profile (and maybe other stuff), then I'd like to have a customer directory with a subdirectory for each of those components and linke them into the right place into the drupal tree for testing and debugging.

Comment actions Permalink

Thank you for such a detailed answer. There is one more configuration that may suit you. Create new empty project wherever you like, then add module, theme and profile as content roots in File | Settings | Directory. Then enable Drupal support in File | Settings | Drupal. Functional you'll get will be exactly the same.

Comment actions Permalink

This sounds very interesting.

I've tried it with one of the customer projects where I'm having a profile, a theme and 3 customer modules. All seems to be working apart from the third include path.

You can see the empty project at the top followed by 5 directories (modules, theme, profile). Underneath there are the external libraries which where added by the Drupal integration. What's missing is the third include path. Even after a restart of PhpStorm that third one doesn't show up. Is this a bug in PhpStorm?

Comment actions Permalink

Oh, thank you, it's a bug. I partly fixed it, but missed that there can be not only project root, but also other source directories. Will reopen it and fix by next EAP: WI-19251

Comment actions Permalink

Hi Elena,

I've just downloaded the latest EAP release and tested the reported fix but it doesn't work yet as expected. I have reported that in WI-19251 but I'm not sure if anyone takes notice when the issue is already set to verified.

Can you please have another look?



Please sign in to leave a comment.