a Sensio Labs Product

The flexible, fast, and secure
template language for PHP

Twig Organization on Github

Twig started as an experiment, but as soon as we started to include it into Symfony2, it became clear that it was a much better templating system than PHP.

Twig now enjoys a large community of developers and it has been adopted by many other Open-Source projects. Like what we did for Silex some time ago, I’m very happy to announce that the Twig code is now hosted on a dedicated Github organization: https://github.com/twigphp/Twig. I’ve also moved the Twig-extensions repository there.

If you are using Twig via Composer, you should not have to change anything.

If you are a Twig contributor or if you cloned Twig in the past, you need to change the origin URL:

$ git remote set-url origin https://github.com/twigphp/Twig.git

Be warned that the fabpot/Twig repository still exists but this is now my personal fork and as such it won’t be up-to-date all the time. That said, I will try to keep it in sync with the new master repository to ease the transition.

If you want to report a bug or submit a pull request, please do so on https://github.com/twigphp/Twig now.

Twig 1.16.2 released

Twig 1.16.2 has just been released:

  • fixed timezone on dates as strings
  • fixed 2-words test names when a custom node class is not used
  • fixed macros when using an argument named like a PHP super global (like GET or POST)
  • fixed date_modify when working with DateTimeImmutable
  • optimized for loops
  • fixed multi-byte characters handling in the split filter
  • fixed a regression in the in operator
  • fixed a regression in the slice filter

Twig 1.16.1 released

Twig 1.16.1 has just been released:

  • improved error reporting in a sandboxed template
  • fixed missing error file/line information under certain circumstances
  • fixed wrong error line number in some error messages
  • fixed the in operator to use strict comparisons
  • sped up the slice filter
  • fixed for mb function overload mb_substr acting different
  • fixed the attribute() function when passing a variable for the arguments

Twig 1.16.0 released

Twig 1.16.0 has just been released:

  • changed url_encode to always encode according to RFC 3986
  • fixed inheritance in a ‘use’-hierarchy
  • removed the __toString policy check when the sandbox is disabled
  • fixed recursively calling blocks in templates with inheritance

PEAR packages won’t be published anymore

I’ve been publishing PEAR packages for Twig since the very first public version. But now that Composer became the de-facto standard for dependency management, I think it’s time to stop generating new PEAR packages for Twig.

So, from now on, I won’t publish PEAR packages for new versions of Twig. That said, the current PEAR channel will continue to work, and I don’t expect to close it anytime soon (you just won’t get any new versions).

Twig 1.15.1 released

Twig 1.15.1 comes with the following bug fixes:

  • fixed the conversion of the special ‘0000-00-00 00:00’ date
  • added an error message when trying to import an undefined block from a trait
  • fixed a C extension crash when accessing defined but uninitialized property.

Twig 1.15.0 released

I’m very happy to announce the immediate availability of Twig 1.15.0.

This version comes with new functions: max and min, a new filter: round, and a new function: source.

It also fixes some issues with the C extension when using the sandbox.

Last, but not the least, the Template::getAttribute() works better when one of your classes uses __call() and throws a BadMethodCallException exception when the method is not supported.

Twig 1.14.2 released

When an error occurs during tempating rendering, Twig tries to find the original template name and line where the error occurred. Under some circumstances, the guess algorithm was wrong and 1.14.2 fixes that.

Twig 1.14.1 released

Twig 1.14 introduced a regression as you are not able to have a variable named “matches” anymore.

1.14.1 fixes this regression and it goes one step further by removing one restriction: you can now use variables with a name that conflicts with a named operator (like in, is, matches, and any custom one you might have created).

Twig 1.14.0 released

Twig 1.14.0 has been released. This new version contains a lot of new features and improvements. This is also the first Twig release that supports HHVM.

Here are the major changes in this version:

  • fixed usage of the html_attr escaping strategy to avoid double-escaping with the html strategy
  • added new operators: ends with, starts with, and matches
  • fixed some compatibility issues with HHVM
  • added a way to add custom escaping strategies
  • fixed the C extension compilation on Windows
  • fixed the batch filter when using a fill argument with an exact match of elements to batch
  • fixed the filesystem loader cache when a template name exists in several namespaces
  • fixed template_from_string when the template includes or extends other ones
  • fixed a crash of the C extension on an edge case

Note that named arguments for macros support was removed before the release as it was not ready yet.

This website is powered by PHP and Twig.