How to change precedence when injecting language

I want to inject PHP into YAML files, with the standard <?php and ?> as delimiters. The problem is, that YAML parsing takes precedence over PHP parsing, so “,” is interpreted as list item separator of YAML list.

How may I change the precedence? I tried something with LanguageInjectionPerformer but that did not work out yet.

I think such tasks must be solved via TemplateLanguageFileViewProvider instead of language injection. Example in Handlebars plugin - com.dmarcotte.handlebars.file.HbFileViewProvider

See GitHub - JetBrains/intellij-plugins: Open-source plugins included in the distribution of IntelliJ IDEA Ultimate and other IDEs based on the IntelliJ Platform

Okay, tried to register a TemplateFileViewProvider, changed the registration of the file ending (in the settings) and now have PHP code highlighted. But how do I tell the IDE, that the PHP_TEMPLATE_TEXT token contents are Yaml?