Search code examples
intellij-ideaphpstormcustomization

Can I customize the "New File" menu in PhpStorm?


I would like to add some other options, like "PHP Enum" or "PHP Interface" directly to this menu. Also, I would like to put PHP-related options first. It is possible tu customize this in PhpStorm? I'm using last version (2022.3.2) with the new UI enabled.

I tried using Appearance & Behaviour -> Menus & Toolbars but that didn't work for me.

enter image description here


Solution

  • Do you know that you can use the universal PHP Class entry and just change the type of the object (and therefore the file template) there? That can be done right away when typing the file or class name -- just use Arrow Up / Down keys:

    enter image description here
    (GREEN rectangle area is where that Up / Down key will work; RED rectangle shows my custom file templates)

    P.S. The template for PHP Enums is also there, it just the screenshot was taken in a project with PHP 8.0 language level (need 8.1 for enums to appear).

    P.P.S. The IDE will remember the last used template when you invoke this dialog again.

    https://www.jetbrains.com/help/phpstorm/creating-php-classes.html


    You can add new entries to this menu by creating custom File Templates at Settings/Preferences | Editor | File and Code Templates https://www.jetbrains.com/help/phpstorm/settings-file-and-code-templates.html

    Here are my test custom file templates:

    enter image description here

    And this is how they appear in that menu:

    enter image description here


    Customizing this menu (removing items, changing their order)

    This is not possible at the moment. https://youtrack.jetbrains.com/issue/IDEA-143090 -- watch this ticket (star/vote/comment) to get notified with any progress.