twig Advanced usage Building the C Extension


Example

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.