Twig is a modern template engine for PHP. Twig is fast. It compiles templates down to plain optimized PHP code. Therefore, the overhead compared to regular PHP code was reduced to the very minimum. Twig is also secure. It has a sandbox mode to evaluate untrusted template code. This allows Twig to be used as a template language for applications where users may modify the template design. This template engine 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.