Developers are able to modify the behavior and possibilities of Twig (the PHP templating engine by Fabien Potencier) in many ways, ranging from very easy to very tough. It all starts with simply registering your extension, but from then on you can choose to create your own filters, functions and tests. I will quickly review your options, and show some best practices. After discussing these basic modifications, we'll take a look at creating token parsers and thinking up custom node types, which will enable you to define your own tags (the things between {% %}). I will demonstrate the inner workings of Twig: from the loader, to the lexer, to the parser, to your own token parser, to creating nodes, filtering nodes using a node visitor and finally to the compiler, which transforms all nodes to plain old PHP.


Comments are closed.

Good talk and speaker, very technical talk about twig internals. I appreciate seeing some good in-depth talks on amsterdamphp.

Very technical for somebody who has yet to do anything with twig it.
In my mind reversing the talk would make it easier to understand for newcomers.
Start with what you can do with Twig, show some cool examples and then dive into how it does what it does.

Overall good talk, gave me some good ideas about how i could implement Twig

Very interesting subject. Gave me quite some new insights into Twig.

Too bad the images didn't show. For a first time I thought you did great. As you do the talk more and more it'll get easier and you'll be more comfortable :)

Keep it up!