Drupal 8 Theming with Twig

Twig is a Flexible, Fast, and Secure template engine for PHP. It is part of the Symfony framework. Twig is easier tag-based syntax, Twig offers a lot more theming level security. Twig is introduced to Drupal. Drupal 8 theme file extension are html.twig instead of .tpl.php.

Advantages using Twig:

  • Fast and secure.
  • Re-usability of template files.
  • Twig is fully unit-tested.
  • Well-documented and easy to learn.
  • IDE integration (Textmate, Vim, PHPStorm, Netbeans, PhpStorm, Eclipse, Sublime Text, Notepad++, Komodo).
  • No additional PHP/HTML mix in template files.
  • Clean error messages and easy to debug.