Tutorial Series

Introduction to Twig

Twig is a flexible, fast, and secure template engine for PHP. This series covers the basics of Twig installation, setup, and usage.
  1. How To Install and Get Started with Twig on a VPS

    September 11, 2013
    If a PHP file becomes more complex (and it will for any application), you will have a big problem with managing the layout of your site. If you want a designer to work with it, this designer will have to search into this file which is what we want to prevent. So the solution is the separation of the presentation (layout) from the logic (programming) and the best way to do it is by using a template engine such as Twig.
  2. How To Design Template Pages with Twig on a VPS

    September 12, 2013
    Twig is a very good alternative to the PHPTemplate way of building the presentation logic of a web application as it is represents a much cleaner templating experience. In this respect, it comes with a very easy to understand syntax and restricts you from performing dynamic PHP operations in template files. In the previous tutorial, we’ve seen how to set up Twig with Composer. In this tutorial, we will dive a bit deeper into its syntax and how you can use it to build up your template files.