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

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

jdwx/web-twig
=============

Integrate twig templates with jdwx/web and jdwx/panels.

v3.0.0(8mo ago)029MITPHPPHP &gt;=8.3.0

Since Jun 8Pushed 8mo agoCompare

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

READMEChangelog (10)Dependencies (8)Versions (12)Used By (0)

jdwx/web-twig
=============

[](#jdwxweb-twig)

A very thin module for integrating Twig templates into other web-related modules.

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

[](#installation)

You can require it directly with Composer:

```
composer require jdwx/web-twig
```

Or download the source from GitHub:

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

[](#requirements)

This module requires PHP 8.3 and Twig 3.0 or later.

Usage
-----

[](#usage)

This module provides a simple interface for integrating Twig templates into panels and pages interfaces provided by the jdwx/panels and jdwx/web-php modules. 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.

You can also use subclasses to avoid repetitive code. For example, if you have all of your error page templates in one directory, you can create a subclass like this:

```
class ErrorPage extends StaticPage {

    /** @param array $i_rValues */
    public function __construct( string $name, array $i_rValues = [] ) {
        # Give it the path to your error templates.
        $env = TwigHelper::forDirectory( __DIR__ . '/templates/' );
        parent::__construct( $env, $name, $i_rValues );
    }

    /** @param array $i_rValues */
    public static function get( string $name, array $i_rValues = [] ) : string {
        return ( new self( $name, $i_rValues ) )->render();
    }

}
```

Then displaying errors is very straightforward:

```
echo ErrorPage::get( 'error404', [ 'return_url' => '/' ] ), "\n\n";
```

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

35

—

LowBetter than 77% of packages

Maintenance59

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

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

Recently: every ~27 days

Total

11

Last Release

263d ago

Major Versions

2.x-dev → v3.0.02025-11-28

### 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 (16 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3841.2M](/packages/limenius-react-bundle)[pdewit/nova-external-url

An external URL Laravel Nova field.

30383.2k](/packages/pdewit-nova-external-url)[wbrowar/guide

A CMS Guide for Craft CMS.

6154.7k1](/packages/wbrowar-guide)[localgovdrupal/localgov_base

The base theme for LocalGov Drupal websites.

13126.9k5](/packages/localgovdrupal-localgov-base)

PHPackages © 2026

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