Spiral Framework: Twig Adapter

v1.1.1 2021-02-23 12:59 UTC

This package is auto-updated.

Last update: 2021-10-23 14:23:42 UTC


Latest Stable Version CI Status Codecov


The extension requires spiral/views package.

$ composer require spiral/twig-bridge

To enable extension modify your application by adding Spiral\Twig\Bootloader\TwigBootloader:

class App extends Kernel
     * List of components and extensions to be automatically registered
     * within system container on application start.
    protected const LOAD = [
        // ...


You can enable any custom twig extension by requesting Spiral\Twig\TwigEngine in your bootloaders:

class TwigExtensionBootloader extends Bootloader 
    public function boot(TwigEngine $engine)
        $engine->addExtension(new Extension());

Lazy Configuration

To configure TwigEngine on demand use functionality provided by TwigBootloader:

class TwigExtensionBootloader extends Bootloader 
    public function boot(TwigBootloader $twig)

Following methods are available setOption, addExtension, addProcessor.