0

I'm working in WebStorm (PhpStorm) on a .php file, and I want to quickly insert the standard HTML5 boilerplate (the <!DOCTYPE html>…</html> structure).

In an .html file, I can type ! and press Tab to get the boilerplate via Emmet. However, in a .php file, it doesn’t seem to work — even if I place my cursor outside the <?php ?> tags.

Here’s an example of my file:

<!-- I want the HTML5 boilerplate inserted here -->

<?php

    echo" i like pizza";
    echo "<br>";
    echo "i love pizza";
    echo "<br>";
    //this is a comment
    /* this is
    a multiline comment
    */
?>

How can I configure PhpStorm so I can type an abbreviation (e.g., !html + Tab) and insert the full HTML5 boilerplate inside a .php file without breaking PHP execution?

1
  • 2
    Well -- it works just fine as is for me -- I can easily use !Tab before the <?php block in a .php file. Not sure what the difference between my and your setup. Mine is PhpStorm 2025.1.4.1 on Windows 10. Commented Aug 12 at 15:56

1 Answer 1

4

I found the answer in documentation , You can solve this by adding a custom Live Template in Phpstorm.
Go to Settings → Editor → Live Templates, click + to make a new one, give it an abbreviation (like html5), paste your HTML5 boilerplate in the template text, and under Applicable in, tick PHP.

Now, in a .php file (outside your PHP tags), just type your abbreviation and hit Tab — you’ll get the full boilerplate instantly.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.