Twig
Last updated
Was this helpful?
Last updated
Was this helpful?
is how the story of Melody began. We initially started by writing a parser and compiler for Twig. The last step in the process of creating Melody was deciding on what output it should produce and how its component API should look like.
Twig is a famous templating language for PHP. It was initially introduced as the default templating language in the Symfony PHP framework.
When compared to Handlebars and other popular templating languages, Twig is quite a bit more powerful. It features template inheritance, blocks, embeds, includes, macros, filters and many other things. Additionally, it has been written to support powerful plugins.
Embedding a variable into a template is similar to other template languages. The {{
and }}
are enclosing an expression which can be used to include a value into a template.
A more powerful feature is blocks. Twig supports many different blocks for all intends and purposes.
The Twig project offers a very good documentation to the template language which we don't want to duplicate here at the moment. Please take a look at their instead.
Melody behaves identical to Twig in almost all cases unless there are technical limitations preventing us from reaching compatibility. If you notice a difference please report it as a .