Initial Twig Support in PhpStorm 2.1

Posted on by Egor Malyshev

Twig is a template engine for PHP. It is powerful, extensible, unit tested, documented, secure and easy to learn, helps to separate logic (written on php) from representation. That’s why we are so glad to introduce Initial Twig support in upcoming PhpStorm 2.1.

By default syntax highlight works for *.twig file types (this might be adjusted in IDE Settings | File Types | Twig).

The language between twig tags can be changed from default HTML to any other supported language in Project Settings | Template Data Language.

Completion and navigation for file names is active in include, extends and import tags.
Basic completion:

Open file in editor (Ctrl + ‘B’ or Ctrl + Left Click):

PhpStorm helpfully closes tags, inserting ‘%}’, ‘}}’ or ‘#}’.
Commenting for lines or blocks of code is available with Ctrl + ‘/’ or Ctrl + Shift + ‘/’ hotkeys respectively.

Twig inherits all other great features of PhpStorm, however the support is at it’s initial stage and your feedback and suggestions will be highly appreciated (Submit an issue).

Develop with pleasure!
-JetBrains Web IDE Team


Subscribe for updates