Is there a built-in zen coding shortcut in PhpStorm to insert a <?php ?>
tag? If not, how would I go about setting one?

- 8,413
- 7
- 27
- 35

- 1,824
- 2
- 18
- 22
5 Answers
No there is not, You can set it by Going to File -> Settings -> -- IDE Settings -- -> Live Templates -> Add And using the following values:-
Abbreviation: php
Group: user
Template Text:<?php $END$ ?>
Context: Check HTML

- 1,558
- 2
- 21
- 35

- 24,066
- 8
- 71
- 57
-
Right. I was looking for "clips", obviously it is live templates in phpstorm. Thank you. – David John Smith May 29 '11 at 04:11
-
8Template text should be: `` – takeshin Jun 12 '11 at 09:32
-
1Is there a way to assign a keyboard shortcut to specific live template? So, for instance ctrl+p would type . – Dziamid Oct 20 '11 at 12:03
-
5I recommend to use this settings instead (type "" and press "SPACE"): http://magicento.com/assets/img/PHPBlock_live_template.jpg – Enrique Feb 13 '14 at 20:59
-
#For Mac User: In phpstorm10 on mac the right path is PhpStorm->Preferences->Editor->Live Templates, click on the PHP and add new Live Template. Thanks to @Salman Abbas – Daniele Montes Mar 15 '16 at 22:02
-
awesome - but the fastest abbreviation could be just `<` then tab. – Mikhail.root Jun 22 '17 at 20:23
In PhpStorm2016.1 must change Applicable in Value to HTML .
Go to File -> Setting -> Editor -> Code Style -> Live Templates On right sidebar click on "+" then : Abbreviation : (for example) p Template text : Applicatin :change the value to HTMLl like befor then click on ok .

- 2,250
- 19
- 32

- 203
- 2
- 6
-
1Live Templates isn't in Code Style (at least in 2018 version) it's beneath it, but otherwise this helped me for more recent versions, thanks. – Chris Jul 25 '18 at 14:49
-
-
In newer versions of PhpStorm(2019.* or higher) adding the shortcut is a little bit different.
First go to File -> Settings
(or simply press CTRL + ALT + S
). Open Editor
tab and find Live Templates
tab. Select PHP and click small blue plus icon at the right sidebar, select live template and:
- Type shortcut on
Abbreviation
input. - Type
<?php $END$ ?>
ontemplate text
area. - Define applicable context like php and html.
- If you want to expand with another key instead tab, you must define another expand key.
Click Apply
and OK
buttons. That's it.

- 2,766
- 2
- 21
- 41
Go to
File --> Settings --> Search & click Live Templates
Click + button on the right side then click Live Template
lastly input following:
Abbreviation: PHP
Template Text: <?php $END$ ?>
Context: Check HTML
Click Apply then OK
Now type php and press tab in a php file
PHP tag (<?PHP ?>) will automatically generated

- 31
- 3
You can set it by going to File -> Settings -> -- IDE Settings -- -> Live Templates
and then input
Abbreviation: php
Group: user
Template Text: php $END$ ?>
Context:
Check HTML

- 3,381
- 9
- 48
- 69

- 19
- 1