Twig is a modern template language for PHP 5.2+ that is flexible, fast, and secure. It supports everything you need to build powerful templates with ease: multiple inheritance, blocks, automatic output-escaping, and much more.
The syntax is easy to learn and has been optimized to allow web designers to get their job done fast without getting in their way. If you have any exposure to other text-based template languages, such as Smarty, Django, or Jinja, you should feel right at home with Twig. It’s both designer and developer friendly by sticking to PHP’s principles and adding functionality useful for templating environments.
- Fast: Twig compiles templates down to plain optimized PHP code. The overhead compared to regular PHP code was reduced to the very minimum.
- Secure: Twig has a sandbox mode to evaluate untrusted template code. This allows Twig to be used as a templating language for applications where users may modify the template design.
- Flexible: Twig is powered by a flexible lexer and parser. This allows the developer to define its own custom tags and filters, and create its own DSL.
Twig is brought to you by Fabien Potencier, the creator of the symfony framework. Twig is released under the new BSD license.. You can find further information, documentation & download on Twig’s Website.