Phpstorm Smarty



There is nothing special about Smarty support in PhpStorm. PhpStorm just offers basic syntax checking and highlighting for Smarty code/tags; code completion for standard tags plus possibly few other small things - that's about it. The dialog box opens when you click in the Language Injection page, and choose Generic Smarty on the context menu, or select an entry and click. PhpStorm comes with a set of predefined injection configurations which is quite sufficient to ensure high productivity and comfortable environment. PhpStorm Smarty Templates Editing PhpStorm IDE allows you to use a Smarty template engine and offers the following productivity features for working with.tpl files: Configurable syntax highlighting for keywords, strings, variables and braces; Syntax errors highlighting; Smarty functions and attributes completion. I am currently evaluating PhpStorm as an alternative to Aptana Studio, we use right now. But one issue really annoys. We use the.tpl file extension for our PHP templates. This file type is usually mapped to Smarty. It was quite easy to set this to 'PHP files (PHP)'. But each time I restart PhpStorm.

File | Settings | PHP | Blade for Windows and Linux
PhpStorm | Preferences | Blade for macOS
Ctrl+Alt+S

This page is available only when the PHP and Blade plugins are installed and enabled. The plugins are activated by default. If the plugins are disabled, enable them on the Plugins page as described in Manage plugins.

Phpstorm Smarty Boy

Text Tags Tab

In this tab, specify the delimiters to use in Blade templates. According to these settings, PhpStorm recognizes templates and provides error highlighting and code completion for them.

The fields in the tab show the opening and closing characters for raw tags, content tags, and escaped tags.

The fields are filled in with the default values in compliance with Blade Templates 5.8. If you are using an earlier version, you can specify the relevant custom delimiters and PhpStorm will provide coding assistance according to the new rules.

Phpstorm smarty boy

Directives Tab

Phpstorm Smarty Cats

In this tab, manage Blade directives for use in PhpStorm. The tab lists all the currently available Blade directives, for those that have parameters, the prefixes and suffixes are also shown. When you start, the list contains only predefined directives. You can edit these directives as well as create custom ones.

Phpstorm Smarty Bear

ItemDescription
Directives The tab lists all the currently available Blade directives, for those that have parameters, the prefixes and suffixes are also shown. When you start, the list contains only predefined directives. You can edit these directives as well as create custom ones.
  • Add () click this button to define a new directive. Specify the directive's name in the Name field.

    If the new directives requires a prefix and a suffix, select the Has parameter checkbox and type the prefix and suffix to use in the Prefix and Suffix fields respectively. PhpStorm will automatically enclose the prefix and suffix in opening and closing brackets and quotes and add a colon separator : so the parameters will look as follows: ('<prefix>:<suffix>').

    To edit an existing directive, select it in the list and change the values in the fields below. To restore the original definition, click .

  • Remove () click this button to remove the selected directive from the list.

  • Reset to defaults () click this button to restore the original definition of the selected directive.

NameIn this field, specify the name of a new directive or edit the name of the selected one.
Has parameters

Select this checkbox to specify a prefix and a suffix for a new directive or for the one selected in the list. When the checkbox is selected, the Prefix and Suffix fields are available for editing. Specify the required directive parameters.

If the new directives requires a prefix and a suffix, select the Has parameter checkbox and type the prefix and suffix to use in the Prefix and Suffix fields respectively. PhpStorm will automatically enclose the prefix and suffix in opening and closing brackets and quotes and add a colon separator : so the parameters will look as follows: ('<prefix>:<suffix>').