PHPackages                             spiral/twig-bridge - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. spiral/twig-bridge

ActiveLibrary[Templating &amp; Views](/categories/templating)

spiral/twig-bridge
==================

Spiral Framework: Twig Adapter

v2.0.1(3y ago)065.9k—0.8%2[2 issues](https://github.com/spiral/twig-bridge/issues)6MITPHPPHP ^8.1

Since Oct 7Pushed 3y ago4 watchersCompare

[ Source](https://github.com/spiral/twig-bridge)[ Packagist](https://packagist.org/packages/spiral/twig-bridge)[ RSS](/packages/spiral-twig-bridge/feed)WikiDiscussions 2.0 Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (15)Used By (6)

Spiral Framework: Twig Adapter
==============================

[](#spiral-framework-twig-adapter)

[![PHP Version Require](https://camo.githubusercontent.com/90f9cbb437ca9a54d296cb5355af8c2fce80e042eb731ccc924158f6bdb7ae2a/68747470733a2f2f706f7365722e707567782e6f72672f73706972616c2f747769672d6272696467652f726571756972652f706870)](https://packagist.org/packages/spiral/twig-bridge)[![Latest Stable Version](https://camo.githubusercontent.com/384d381d86bea7110f40a301d50588e2cf44aa6f8b25804151dca3fa00225262/68747470733a2f2f706f7365722e707567782e6f72672f73706972616c2f747769672d6272696467652f762f737461626c65)](https://packagist.org/packages/spiral/twig-bridge)[![phpunit](https://github.com/spiral/twig-bridge/actions/workflows/phpunit.yml/badge.svg)](https://github.com/spiral/twig-bridge/actions)[![psalm](https://github.com/spiral/twig-bridge/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/spiral/twig-bridge/actions)[![Codecov](https://camo.githubusercontent.com/9081cbe80635b4c4c5ba162555a1c896ee659fe3e17a93b7906510fb7e78c6da/68747470733a2f2f636f6465636f762e696f2f67682f73706972616c2f747769672d6272696467652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/spiral/twig-bridge/)[![Total Downloads](https://camo.githubusercontent.com/0d48cc9c637239d650dd0f4034eb35a04e2aa3fa30f27d68500e4c8613378e69/68747470733a2f2f706f7365722e707567782e6f72672f73706972616c2f747769672d6272696467652f646f776e6c6f616473)](https://packagist.org/packages/spiral/twig-bridge)[![type-coverage](https://camo.githubusercontent.com/03c396b6a101869a3dfed7d4cd4c65177663dbd1d8b44043fcbd191999bd5543/68747470733a2f2f73686570686572642e6465762f6769746875622f73706972616c2f747769672d6272696467652f636f7665726167652e737667)](https://shepherd.dev/github/spiral/twig-bridge)[![psalm-level](https://camo.githubusercontent.com/3d88d879ceface8479e3a37b883574b84047eac3bb45718fd340881571ef17b9/68747470733a2f2f73686570686572642e6465762f6769746875622f73706972616c2f747769672d6272696467652f6c6576656c2e737667)](https://shepherd.dev/github/spiral/twig-bridge)

**[Documentation](https://spiral.dev/docs/views-twig)** | [Framework Bundle](https://github.com/spiral/framework)

Installation
------------

[](#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
-------------

[](#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
------------------

[](#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:
--------

[](#license)

MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information. Maintained by [Spiral Scout](https://spiralscout.com).

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~110 days

Recently: every ~158 days

Total

14

Last Release

1342d ago

Major Versions

v1.1.1 → v2.0.02022-05-31

PHP version history (4 changes)v1.0.0PHP ^7.1

v1.0.7PHP ^7.2

v1.0.8PHP &gt;=7.2

v2.0.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/796136?v=4)[Anton Tsitou](/maintainers/wolfy-j)[@wolfy-j](https://github.com/wolfy-j)

---

Top Contributors

[![wolfy-j](https://avatars.githubusercontent.com/u/796136?v=4)](https://github.com/wolfy-j "wolfy-j (36 commits)")[![butschster](https://avatars.githubusercontent.com/u/773481?v=4)](https://github.com/butschster "butschster (10 commits)")[![SerafimArts](https://avatars.githubusercontent.com/u/2461257?v=4)](https://github.com/SerafimArts "SerafimArts (9 commits)")[![msmakouz](https://avatars.githubusercontent.com/u/67324318?v=4)](https://github.com/msmakouz "msmakouz (7 commits)")[![anlamas](https://avatars.githubusercontent.com/u/31503975?v=4)](https://github.com/anlamas "anlamas (4 commits)")[![sergey-telpuk](https://avatars.githubusercontent.com/u/4964014?v=4)](https://github.com/sergey-telpuk "sergey-telpuk (3 commits)")[![SergeyTelpuk](https://avatars.githubusercontent.com/u/40434695?v=4)](https://github.com/SergeyTelpuk "SergeyTelpuk (2 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

php7renderingspiralspiral-frameworktwigtwig-adapter

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/spiral-twig-bridge/health.svg)

```
[![Health](https://phpackages.com/badges/spiral-twig-bridge/health.svg)](https://phpackages.com/packages/spiral-twig-bridge)
```

###  Alternatives

[twig/intl-extra

A Twig extension for Intl

36763.2M221](/packages/twig-intl-extra)[rcrowe/twigbridge

Adds the power of Twig to Laravel

9105.9M50](/packages/rcrowe-twigbridge)[twig/string-extra

A Twig extension for Symfony String

22046.0M133](/packages/twig-string-extra)[twig/cssinliner-extra

A Twig extension to allow inlining CSS

22918.5M55](/packages/twig-cssinliner-extra)[symfony/ux-twig-component

Twig components for Symfony

21914.8M162](/packages/symfony-ux-twig-component)[twig/markdown-extra

A Twig extension for Markdown

12114.3M83](/packages/twig-markdown-extra)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
