Is there a way to define folder templates?

I'm using PhpStorm for Drupal development and it would be great if I could define a template that would setup the appropriate folder and files for a Drupal module.  The desired end result would be the following:

  • Right-click on a folder and select New -> Drupal Module
  • Enter the name of the Drupal module (e.g. "mymodule")
  • PhpStorm would create the following:
    • Folder named "mymodule"
    • PHP file named "mymodule.module"
    • Module info file named ""

Is there a way to do this with PhpStorm already or should I file a feature request?



Comment actions Permalink

Hi Shawn,

There is no such functionality available in PhpStorm ... and I do not think it's going to be implemented any time soon (as this is Drupal-specific feature, I guess).

You can see what is currently planned for future versions here:

Existing ticket for Drupal support:

Comment actions Permalink

Thanks Andriy,

I think this may be similar to the "Project Template" feature that is being investigated.  I don't consider this to be a Drupal specific feature, but a more generic feature that allows you to define and generate an arbitrary set of files and folders.

Comment actions Permalink

I know this post is ancient, but this would be super useful for Polymer.  Does anyone know if there is any news on this feature in the last 3 years?

Comment actions Permalink

For now I have written a batch file that resides in my /templates/ folder.  

@echo off
set seed=seed-element
set target=%1
@echo Creating new element named "%target%"
echo Creating Folder...
md %target%
echo copying seed files from %seed%...
copy %seed%\%seed%.html %target%\%target%.html >nul
copy %seed%\%seed%.less %target%\%target%.less >nul
copy %seed%\demo.html %target%\demo.html >nul
copy %seed%\index.html %target%\index.html >nul
copy %seed%\ %target%\ >nul
copy %seed%\bower.json %target%\bower.json >nul
copy %seed%\tests %target%\tests >nul
echo Done!

So now I can just open the terminal and type "create my-new-template" and it does the rest.

Comment actions Permalink

I have updated my batch file.  It now scans files for a ${NAME} variable and replaces each instance with the specified name.  Currently, the bat file is hard-coded to match a Polymer file structure, but it is very easy to modify.

Here it is on Github if anyone is interested:


Please sign in to leave a comment.