Overview
Twig is a template engine for PHP applications. It allows developers to render views using a concise template language rather than mixing all presentation markup directly into PHP files.
Useful capabilities
Twig supports template inheritance, includes, filters, functions, tests, autoescaping and reusable blocks. These features help teams maintain a consistent layout across pages.
When to consider it
Twig can be useful when an application has many views, shared page layouts or a team that wants a clear separation between controllers and presentation. It can also be integrated into custom PHP applications without adopting a full-stack framework.
Security note
Twig's escaping behavior is important, but developers must understand when data is marked safe and how output contexts differ. Do not disable autoescaping casually or treat untrusted HTML as trusted content.