twig

Advanced usage

Remarks#

Please note that the Twig extension is not compatible with PHP7 and although there is a pull request to resolve this situation it was not yet made part of version 1.x. With the most recent Twig 2.x release the C extension was removed but might be part of 2.1. Some benchmarks reveal minimal improvements with the C extension under PHP7.

Building the C Extension

The C extension is an optional feature of Twig that offers some performance improvements of template rendering. The source code for the extension is located in the Twig source code directory at ext/twig. It compiles like any other PHP extentension:

cd ext/twig
phpize
./configure
make
make install

Enable the extension in the php.ini file. Once the extension is installed, Twig will automatically detect and use it at runtime.


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow