phpStorm and component-based projects

For phpDocumentor I sometimes need to edit both a template and the main project in tandem to fix an issue. A sub-optimal solution as it is a clear sign of code coupling yet sometimes your template just relies on a bugfix or new feature in the host application.

Previously I always opened 2 phpStorm windows to manage this and this was always a bit unsettling. As much as they are two separate components, they are still two pieces of one final puzzle.

And then I remembered the directories panel in the Settings. There you can define multiple ‘content roots’ which actually act as modules in one project file. phpStorm even knows how to manage the version control for these separate roots, making it ideal to manage multiple components from one project!

This is what your project looks like afterwards:

Here you can clearly see that my project structure now contains two ‘main’ folders instead of one. It seems simple but it is actually pretty neat when working with component-based projects.