PHPackages                             megumi/wp-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. megumi/wp-twig

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

megumi/wp-twig
==============

0.5.0(10y ago)1248GPL2PHPPHP &gt;=5.3

Since Sep 1Pushed 8y ago2 watchersCompare

[ Source](https://github.com/megumi-wp-composer/wp-twig)[ Packagist](https://packagist.org/packages/megumi/wp-twig)[ RSS](/packages/megumi-wp-twig/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (1)Versions (8)Used By (0)

megumi/wp-twig
==============

[](#megumiwp-twig)

[![Build Status](https://camo.githubusercontent.com/8c42ec456366dc102fa8603b112703a8ec2a38ca322ac61ea675867858c5114f/68747470733a2f2f7472617669732d63692e6f72672f6d6567756d692d77702d636f6d706f7365722f77702d747769672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/megumi-wp-composer/wp-twig)[![Latest Stable Version](https://camo.githubusercontent.com/2f9e189ee26268a6ad8f70f87c63d44953322f7b43ed560e489aec110f251e45/68747470733a2f2f706f7365722e707567782e6f72672f6d6567756d692f77702d747769672f762f737461626c652e737667)](https://packagist.org/packages/megumi/wp-twig)[![Total Downloads](https://camo.githubusercontent.com/a7a1dc18c5071ba24b09f6d1e29bd12c9b388ab2feaca0de79b779c98df844ad/68747470733a2f2f706f7365722e707567782e6f72672f6d6567756d692f77702d747769672f646f776e6c6f6164732e737667)](https://packagist.org/packages/megumi/wp-twig)[![Latest Unstable Version](https://camo.githubusercontent.com/063ed19d2ceb7016507e75c9f2ee7e61f3e4ebceac325eb4dab265cf793158e7/68747470733a2f2f706f7365722e707567782e6f72672f6d6567756d692f77702d747769672f762f756e737461626c652e737667)](https://packagist.org/packages/megumi/wp-twig)[![License](https://camo.githubusercontent.com/7e5ed81674566ce4278dae793ef331d0ae2df020a3ebc15e24cff0f556e07a90/68747470733a2f2f706f7365722e707567782e6f72672f6d6567756d692f77702d747769672f6c6963656e73652e737667)](https://packagist.org/packages/megumi/wp-twig)

Integrates Twig template engine to WordPress.

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

[](#installation)

Create a composer.json in your plugin root or mu-plugins

```
{
    "require": {
        "megumi/wp-twig": "*"
    }
}

```

Place the following code into your plugin.

```
require_once dirname( __FILE__ ) . '/vendor/autoload.php';

```

Then:

```
$ composer install

```

How to use
----------

[](#how-to-use)

```
$twig = new Twig_Environment( new Twig_Loader_String() );
$twig->addExtension( new Megumi\WP\Twig_Extension() );

$content = $twig->render( '{{ name | esc_html }}', array( 'name' => '' ) );
$this->assertSame( '&lt;strong&gt;', $content );

```

Twig filter extensions for WordPress
------------------------------------

[](#twig-filter-extensions-for-wordpress)

- `esc_html`
- `esc_attr`
- `esc_textarea`
- `esc_url`
- `esc_js`

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

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

Total

6

Last Release

3929d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1366a673de80559a738e11fb4bd3600842f45ebc21abe8e2842e7205686a3ca0?d=identicon)[miya0001](/maintainers/miya0001)

---

Top Contributors

[![miya0001](https://avatars.githubusercontent.com/u/309946?v=4)](https://github.com/miya0001 "miya0001 (16 commits)")

### Embed Badge

![Health badge](/badges/megumi-wp-twig/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[mati365/ckeditor5-symfony

CKEditor 5 integration for Symfony

262.6k](/packages/mati365-ckeditor5-symfony)

PHPackages © 2026

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