PHPackages                             yiisoft/yii2-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. [Framework](/categories/framework)
4. /
5. yiisoft/yii2-twig

ActiveYii2-extension[Framework](/categories/framework)

yiisoft/yii2-twig
=================

The Twig integration for the Yii framework

2.5.1(1y ago)1431.9M↓11.5%60[3 issues](https://github.com/yiisoft/yii2-twig/issues)[1 PRs](https://github.com/yiisoft/yii2-twig/pulls)20BSD-3-ClausePHPPHP ^7.2.5|^8.0|^8.1CI passing

Since Dec 11Pushed 3mo ago26 watchersCompare

[ Source](https://github.com/yiisoft/yii2-twig)[ Packagist](https://packagist.org/packages/yiisoft/yii2-twig)[ GitHub Sponsors](https://github.com/yiisoft)[ Fund](https://opencollective.com/yiisoft)[ RSS](/packages/yiisoft-yii2-twig/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (24)Used By (20)

 [ ![](https://camo.githubusercontent.com/baea95c9cb6fb1dea300746b392f38db3338f9bc0a5eae0d4a4e06066fd5b66a/68747470733a2f2f747769672e73796d666f6e792e636f6d2f696d616765732f747769672d6c6f676f2e706e67) ](https://twig.symfony.com/)

Twig Extension for Yii 2
========================

[](#twig-extension-for-yii-2)

This extension provides a `ViewRender` that would allow you to use [Twig](https://twig.symfony.com/) view template engine with [Yii framework 2.0](https://www.yiiframework.com).

For license information check the [LICENSE](LICENSE.md)-file.

Documentation is at [docs/guide/README.md](docs/guide/README.md).

[![Latest Stable Version](https://camo.githubusercontent.com/63de3c52b7183a92dcb8d13141e73b81d28e0594d10a20f14b6580016450b2d7/68747470733a2f2f706f7365722e707567782e6f72672f796969736f66742f796969322d747769672f762f737461626c652e706e67)](https://packagist.org/packages/yiisoft/yii2-twig)[![Total Downloads](https://camo.githubusercontent.com/47b9f9b0556392d12a611a190d1b0ce78dfc7ddd99aa6e5cf867d599ced889f8/68747470733a2f2f706f7365722e707567782e6f72672f796969736f66742f796969322d747769672f646f776e6c6f6164732e706e67)](https://packagist.org/packages/yiisoft/yii2-twig)[![Build Status](https://github.com/yiisoft/yii2-twig/workflows/build/badge.svg)](https://github.com/yiisoft/yii2-twig/actions)[![codecov](https://camo.githubusercontent.com/89393735bb3a6a15263d9dd2b81d8917ef3c0b9b2a8d6f65b0951e700456860c/68747470733a2f2f636f6465636f762e696f2f67682f796969736f66742f796969322d747769672f67726170682f62616467652e737667)](https://codecov.io/gh/yiisoft/yii2-twig)

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

[](#installation)

Important

- The minimum required [PHP](https://www.php.net/) version is PHP `7.4`.
- It works best with PHP `8`.

The preferred way to install this extension is through [composer](https://getcomposer.org/download/):

```
php composer.phar require --prefer-dist yiisoft/yii2-twig

```

Usage
-----

[](#usage)

To use this extension, configure it as described in [documentation](docs/guide/installation.md#configuring-application).

###  Health Score

65

—

FairBetter than 99% of packages

Maintenance64

Regular maintenance activity

Popularity58

Moderate usage in the ecosystem

Community48

Growing community involvement

Maturity82

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~190 days

Recently: every ~248 days

Total

23

Last Release

357d ago

Major Versions

2.5.1 → 22.x-dev2025-05-26

PHP version history (5 changes)2.3.0PHP ^7.0

2.4.0PHP ^7.2.5

2.4.1PHP ^7.2.5|^8.0

2.4.2PHP ^7.2.5|^8.0|^8.1

22.x-devPHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/261a6249c6f605f3956a2fae40fbb813f6b2e1e6f2bf806180c851a965426e54?d=identicon)[cebe](/maintainers/cebe)

![](https://www.gravatar.com/avatar/fc29e4e7068a00fe9b9db37b8aadda1db6020adcacef810461e47b99c2b150e6?d=identicon)[samdark](/maintainers/samdark)

![](https://www.gravatar.com/avatar/23416c58e0dce33a8369451a4ca0e28666373594027debc10184b37ade6a926b?d=identicon)[qiangxue](/maintainers/qiangxue)

![](https://www.gravatar.com/avatar/ccb75e3312d6bd454ea445ea308139fd185a4ca906ca5df21cc66e6a35de25a3?d=identicon)[SilverFire](/maintainers/SilverFire)

![](https://www.gravatar.com/avatar/99106256c24a8cb23871b99fa90e48f37f1aa71608c185759b7d2a88683a5918?d=identicon)[hiqsol](/maintainers/hiqsol)

---

Top Contributors

[![qiangxue](https://avatars.githubusercontent.com/u/993322?v=4)](https://github.com/qiangxue "qiangxue (1900 commits)")[![cebe](https://avatars.githubusercontent.com/u/189796?v=4)](https://github.com/cebe "cebe (741 commits)")[![samdark](https://avatars.githubusercontent.com/u/47294?v=4)](https://github.com/samdark "samdark (733 commits)")[![klimov-paul](https://avatars.githubusercontent.com/u/1482054?v=4)](https://github.com/klimov-paul "klimov-paul (322 commits)")[![creocoder](https://avatars.githubusercontent.com/u/896494?v=4)](https://github.com/creocoder "creocoder (148 commits)")[![resurtm](https://avatars.githubusercontent.com/u/100198?v=4)](https://github.com/resurtm "resurtm (123 commits)")[![tonydspaniard](https://avatars.githubusercontent.com/u/566016?v=4)](https://github.com/tonydspaniard "tonydspaniard (95 commits)")[![Ragazzo](https://avatars.githubusercontent.com/u/1748844?v=4)](https://github.com/Ragazzo "Ragazzo (75 commits)")[![lucianobaraglia](https://avatars.githubusercontent.com/u/374554?v=4)](https://github.com/lucianobaraglia "lucianobaraglia (44 commits)")[![suralc](https://avatars.githubusercontent.com/u/730039?v=4)](https://github.com/suralc "suralc (42 commits)")[![pmoust](https://avatars.githubusercontent.com/u/2493339?v=4)](https://github.com/pmoust "pmoust (36 commits)")[![schmunk42](https://avatars.githubusercontent.com/u/649031?v=4)](https://github.com/schmunk42 "schmunk42 (27 commits)")[![antgubarev](https://avatars.githubusercontent.com/u/2937969?v=4)](https://github.com/antgubarev "antgubarev (27 commits)")[![slavcodev](https://avatars.githubusercontent.com/u/757721?v=4)](https://github.com/slavcodev "slavcodev (20 commits)")[![LarryUllman](https://avatars.githubusercontent.com/u/1674823?v=4)](https://github.com/LarryUllman "LarryUllman (18 commits)")[![softark](https://avatars.githubusercontent.com/u/342857?v=4)](https://github.com/softark "softark (17 commits)")[![kartik-v](https://avatars.githubusercontent.com/u/3592619?v=4)](https://github.com/kartik-v "kartik-v (16 commits)")[![koxu1996](https://avatars.githubusercontent.com/u/6506780?v=4)](https://github.com/koxu1996 "koxu1996 (13 commits)")[![bwoester](https://avatars.githubusercontent.com/u/309565?v=4)](https://github.com/bwoester "bwoester (12 commits)")[![crtlib](https://avatars.githubusercontent.com/u/4428231?v=4)](https://github.com/crtlib "crtlib (12 commits)")

---

Tags

hacktoberfesttemplate-enginetwigyiiyii2twigyii2renderer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yiisoft-yii2-twig/health.svg)

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

###  Alternatives

[yiisoft/yii2-smarty

The Smarty integration for the Yii framework

74371.8k15](/packages/yiisoft-yii2-smarty)[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13825.6k47](/packages/skeeks-cms)[cakephp/twig-view

Twig powered View for CakePHP

155.1M10](/packages/cakephp-twig-view)[yiisoft/view-twig

Yii Framework Twig Extension

261.2k](/packages/yiisoft-view-twig)

PHPackages © 2026

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