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

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

jdwx/twig
=========

A very thin module for integrating Twig templates with other modules.

v2.0.2(4mo ago)0181MITPHPPHP &gt;=8.3.0

Since Mar 23Pushed 4mo ago1 watchersCompare

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

READMEChangelog (4)Dependencies (6)Versions (5)Used By (1)

twig
====

[](#twig)

A very thin module for integrate Twig templates into other modules.

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

[](#installation)

You can require it directly with Composer:

```
composer require jdwx/twig
```

Or download the source from GitHub:

Requirements
------------

[](#requirements)

This module requires PHP 8.3, Twig 3.0 or later, and jdwx/web 2.0 or later.

Usage
-----

[](#usage)

This module provides a simple interface for integrating Twig templates into the HtmlPage class provided by jdwx/web. The AbstractPage class can be subclassed to provide values when the template is rendered. The StaticPage class allows values to be provided when the page is instantiated. The MapPage class binds a Map that can be updated at any time.

Here is a basic usage example of using the StaticTwigStream class:

```
    $env = TwigHelper::forDirectory( __DIR__ . '/templates' );

    $twig = new StaticTwigStream( $env, 'example', [ 'name' => 'Static' ] );
    echo $twig, "\n"; # "Hello, Static!"
```

and the MapTwigStream class:

```
    $map = new Map();
    $twig = new MapTwigStream( $env, 'example', $map );
    $map->put( 'name', 'Map' );
    echo $twig, "\n"; # "Hello, Map!"
```

Stability
---------

[](#stability)

This module is relatively new and has not been extensively deployed in production yet, but the interface should be relatively stable. There's really not a lot to it; this module exists mainly to keep from introducing Twig as a dependency where it's not needed.

History
-------

[](#history)

This module was loosely adapted from an existing codebase in early 2025.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance76

Regular maintenance activity

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

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

Total

4

Last Release

128d ago

Major Versions

v1.0.0 → v2.0.02025-06-07

### Community

Maintainers

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

---

Top Contributors

[![jdwx](https://avatars.githubusercontent.com/u/2722779?v=4)](https://github.com/jdwx "jdwx (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[twig/extra-bundle

A Symfony bundle for extra Twig extensions

91292.0M315](/packages/twig-extra-bundle)[twig/intl-extra

A Twig extension for Intl

36663.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

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

A Twig extension to allow inlining CSS

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

Twig components for Symfony

21814.8M162](/packages/symfony-ux-twig-component)

PHPackages © 2026

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