Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Twig Bridge Laravel Package

spiral/twig-bridge

Twig adapter for the Spiral Framework. Adds a Twig view engine via TwigBootloader, with support for custom extensions, options, and processors. Configure eagerly through TwigEngine or lazily through TwigBootloader. Requires spiral/views.

View on GitHub
Deep Wiki
Context7

Spiral Framework: Twig Adapter

PHP Version Require Latest Stable Version phpunit psalm Codecov Total Downloads type-coverage psalm-level

Documentation | Framework Bundle

Installation

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 = [
        // ...
        
        Spiral\Twig\Bootloader\TwigBootloader::class,
    ];
}

Configuration

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)
    {
        $twig->addExtension('container.binding');
    }
}

Note Following methods are available setOption, addExtension, addProcessor.

License:

MIT License (MIT). Please see LICENSE for more information. Maintained by Spiral Scout.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky