Twig

Twig is a flexible, fast, and secure template engine for the PHP programming language, designed to separate presentation logic from business logic. It compiles templates into plain optimized PHP classes, which significantly improves performance and offers advanced features like sandboxing for…

Key facts

First appeared
2009
Category
technology
Problem solved
Twig was created to address the pervasive issues of intertwined PHP code and HTML within template files, a practice often leading to messy, insecure, and difficult-to-maintain web applications. It aimed to provide a clear separation of concerns, enforce a secure templating environment through automatic escaping and sandboxing, and deliver high performance by compiling templates into optimized PHP code, a capability many predecessors lacked or executed less efficiently.
Platforms
Web Servers (Apache, Nginx), PHP Runtime (Linux, Windows, macOS)

Related technologies

Notable users

  • Numerous small to large web development agencies and enterprises utilizing Symfony or Drupal
  • SensioLabs (Symfony)
  • Spotify
  • Acquia (Drupal)
  • Magento Commerce (for some components)