PhpStorm
 
Get PhpStorm

Language injections

Last modified: 11 October 2024

Language injections let you work with pieces of code in other languages embedded in your code. When you inject a language (such as HTML, CSS, XML, RegExp, and so on) into a string literal, you get comprehensive coding assistance for the injected code even though it is not the main language of your project.

In the PHP context, you can use the special PHP dialect called Injectable PHP. This dialect is similar to PHP, with the exception for the <?php opening tag, which can be omitted. Injectable PHP can be injected into string literals manually, just as any other language. In addition, it is automatically injected into eval() calls and in Markdown fenced code blocks with the language identifier set to php.