Twig is a templating language that compiles to optimized PHP code. It is primarily used for outputting HTML, but can also be used to output any other text-based format. It is a standalone component that can be easily integrated into any PHP project.
It provides many excellent features:
Official Twig Templating Documentation
Example of Twig's syntax:
{% extends "base.html" %}
{% block sidebar %}
{{ parent() }}
<span>Sidebar content specific to this page</span>
{% endblock sidebar %}
{% block body %}
<p>Select an item:</p>
<ul>
{% for item in list %}
<li><a href="/items/{{ item.id }}">{{ item.name }}</a>
{% else %}
<li>No items yet.
{% endfor %}
</ul>
{% endblock body %}