PHPackages                             mvo/contao-twig - 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. mvo/contao-twig

ActiveContao-bundle[Templating &amp; Views](/categories/templating)

mvo/contao-twig
===============

Replace your Contao php templates with Twig templates.

v1.1.1(5y ago)82.7k[1 PRs](https://github.com/m-vo/contao-twig/pulls)MITPHPPHP &gt;=7.4

Since Mar 19Pushed 5y ago2 watchersCompare

[ Source](https://github.com/m-vo/contao-twig)[ Packagist](https://packagist.org/packages/mvo/contao-twig)[ RSS](/packages/mvo-contao-twig/feed)WikiDiscussions main Synced today

READMEChangelog (8)Dependencies (8)Versions (13)Used By (0)

Twig for Contao Templates
=========================

[](#twig-for-contao-templates)

### How to use

[](#how-to-use)

1. Make sure you have your `twig.default_path` set. For example like this:

    ```
    twig:
      default_path: '%kernel.project_dir%/templates'
    ```
2. Put a template you want to provide as a twig version inside your template directory (can be any subdirectory). Name it like the Contao template but with `.html.twig` as file extension instead of `.html5`.

    For example put a `ce_downloads.html.twig` file under `templates/Contao`.
3. Rebuild your cache (the filesystem is scanned for templates in a compiler pass).

    **Note**: for a better DX your templates will always be loaded in the *dev* environment.

    That's it. Your new template is now rendered instead. It has the same context as the existing Contao one would have (`Template->getData()`). ✨

#### Caveats

[](#caveats)

As Contao uses input encoding, you'll need to deal for already encoded variables yourself by adding the `|raw` filter. Use with caution and be sure you know what you are doing.

Some contao templates contain closures that won't be evaluated by Twig - if you want to use them wrap them in the `fn()` function shipping with this bundle. This will simply execute them and return the 'safe' output (no need for `|raw`).

#### Example

[](#example)

```
{# templates/Contao/ce_downloads.html.twig #}

        {% for file in files %}

                    {{ file.link }} ({{ file.filesize }})

        {% endfor %}

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~49 days

Recently: every ~85 days

Total

8

Last Release

1896d ago

Major Versions

v0.5 → v1.02020-03-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/ebbd1a2ef505d2afa0c828ea08244e9636e397bc837ec3cf6daa74ff07f08e0b?d=identicon)[m-vo](/maintainers/m-vo)

---

Top Contributors

[![m-vo](https://avatars.githubusercontent.com/u/5305677?v=4)](https://github.com/m-vo "m-vo (21 commits)")

---

Tags

twigcontao

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mvo-contao-twig/health.svg)

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

###  Alternatives

[twig/extra-bundle

A Symfony bundle for extra Twig extensions

91292.0M313](/packages/twig-extra-bundle)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

545.8M69](/packages/symfony-ux-icons)[yellowskies/qr-code-bundle

Symfony Barcode &amp; QR Code Generator Bundle with Twig extension

36682.9k](/packages/yellowskies-qr-code-bundle)[symfony/ux-toolkit

A tool to easily create a design system in your Symfony app with customizable, well-crafted Twig components

1432.0k](/packages/symfony-ux-toolkit)[contao-themes-net/mate-theme-bundle

mate theme bundle for Contao 5

1219.2k1](/packages/contao-themes-net-mate-theme-bundle)[zenstruck/twig-service-bundle

Make functions, static methods, Symfony service methods available in your twig templates.

1310.1k](/packages/zenstruck-twig-service-bundle)

PHPackages © 2026

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