twig Advanced usage 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
make install

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