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)72.7k[1 PRs](https://github.com/m-vo/contao-twig/pulls)MITPHPPHP &gt;=7.4CI failing

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 3w ago

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

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

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

1951d ago

Major Versions

v0.5 → v1.02020-03-30

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5305677?v=4)[M. Vondano](/maintainers/m-vo)[@m-vo](https://github.com/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

913100.5M461](/packages/twig-extra-bundle)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

567.3M140](/packages/symfony-ux-icons)[symfony/ux-toolkit

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

16126.1k1](/packages/symfony-ux-toolkit)[contao/manager-bundle

Provides the Contao Managed Edition

181.3M74](/packages/contao-manager-bundle)[ehyiah/ux-quill

Symfony UX Bundle to use Quill JS wysiwyg text editor with full and easy customisation

6492.2k3](/packages/ehyiah-ux-quill)[yellowskies/qr-code-bundle

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

37711.6k](/packages/yellowskies-qr-code-bundle)

PHPackages © 2026

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