Twital

Feel power of Twig using an AngularJS-like syntax

Who Am I?


Asmir Mustafic


Born in Bonsia, grew up in Italy, living in Berlin!

Working as freelance/consultant
(mainly PHP)

Do you know Twig?

Twig

Twig is a modern template engine for PHP

  • 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 template 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.

http://twig.sensiolabs.org/

Twig template example

This presentation is about
template engines ...

Ok...

Yet another template engine?

yes! let's see....

What is
Twital
?

Twital

Twig plugin (template loader)

Allows to mix Twig and Twital syntax
AngularJs/PHPTal like

Adds some features and syntactic sugar on top of Twig

100% compatible with Twig

Twig

How to render a twig template

Twital

How to render a twital template

page.twig

page.twital

page.twital

page.twital

page.twital

page.twital

page.twital

That's it!

Extra info: Template Inheritance, Auto escaping + Context aware escaping, Fast as Twig, Symfony2 support (assetic, forms, routing, translations...)


.. if it can be done with Twig, it can be done with Twital*

Wanna try?

https://github.com/goetas/twital
Documentation: http://twital.readthedocs.org


Symfomy2 user?
https://github.com/goetas/twital-bundle
Documentation: http://twitalbundle.readthedocs.org

Info

  • MIT License
  • ~90% test coverage
  • 9.1 scrutinizer-ci score
  • PHP 5.3 -> PHP 7
  • HHVM 3.3 -> 3.8
  • stable and used in production
    (v1.0 will be released when Twig 2.0 will be ready)

Thanks!



Questions?