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

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

achttienvijftien/wp-twig-bundle
===============================

Bridges a host-owned Twig environment (Timber, ...) into the 1815 service container as the twig service

1.0.2(3w ago)02.9k1GPL-3.0-or-laterPHPPHP ^8.3

Since Jul 3Pushed 3w agoCompare

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

READMEChangelog (2)Dependencies (8)Versions (4)Used By (1)

wp-twig-bundle
==============

[](#wp-twig-bundle)

Bridges a host-owned Twig environment (Timber, ...) into the [1815 service container](https://packagist.org/packages/achttienvijftien/service-container)as the `twig` service.

What it does
------------

[](#what-it-does)

- **The `twig` service**: the container exposes the host's Twig environment (captured via a `TwigEnvironmentHolder`) as `twig` / `Twig\Environment`, so container services render with the SAME instance the host renders with.
- **A LOAD-BEARING bundle name**: the bundle class is named `TwigBundle` on purpose. `Bundle::getName()` returns the short class name, and packages such as ux-twig-component refuse to load unless `kernel.bundles` contains a `'TwigBundle'` key. Registering this bundle satisfies that check honestly: this IS the bundle that provides the `twig` service in this stack. Symfony's own TwigBundle cannot be registered alongside it (duplicate name), which is correct: the two architectures are mutually exclusive.
- **The adapter seam**: `TwigAdapter` abstracts who owns the environment. A Timber adapter is included; for Tile or plain Twig, implement `TwigAdapter`and alias it in your container.
- **The configurator tag**: other bundles contribute environment setup (lexers, escaper safe-classes, ...) by implementing `EnvironmentConfiguratorInterface`, autoconfigured with the `wp_twig.configurator` tag. The bundle also consumes the standard `twig.extension` and `twig.runtime` tags, like Symfony's TwigBundle would.
- **Auto `@BundleName` template namespaces**: on boot, every registered bundle's `/templates` directory is registered on the host loader as `@` (e.g. ux-turbo's templates become `@Turbo`), mirroring symfony/twig-bundle's convention so templates and component resolution written against the native bundle work unchanged.

Usage
-----

[](#usage)

The bundle registers like a native Symfony bundle: list it in the project's `config/bundles.php` (a Flex recipe writes that entry on `composer require`):

```
return [
	AchttienVijftien\Bundle\WpTwigBundle\TwigBundle::class => [ 'all' => true ],
];
```

Once the container boots:

```
$twig = apply_filters( 'achttienvijftien/container', null )->get( 'twig' );
// Same environment Timber renders with, after Timber built it.
```

Contribute environment setup from another bundle:

```
class MyConfigurator implements \AchttienVijftien\Bundle\WpTwigBundle\EnvironmentConfiguratorInterface {
	public function configure( \Twig\Environment $environment ): void {
		// runs once per host environment instance
	}
}
```

Timber adapter included; Tile/other hosts: implement `TwigAdapter`.

Compatibility
-------------

[](#compatibility)

This package is **service-id + tag level compatible** with code written against symfony/twig-bundle:

- the `twig` service / `Twig\Environment` alias and the lazy `twig.loader`service exist with the expected semantics;
- the `twig.extension` and `twig.runtime` tags are consumed;
- `@Bundle` template namespaces auto-register per the same convention.

It is **NOT FQCN-level compatible**: `class_exists` gates on `Symfony\Bundle\TwigBundle\...` classes cannot be satisfied, because that package is deliberately not installed.

Future: native symfony/twig-bundle
----------------------------------

[](#future-native-symfonytwig-bundle)

The door stays open, but environment OWNERSHIP is the blocker: Timber owns its Twig environment (and its autoescape defaults differ from the native bundle's), so the container cannot simply build a second, authoritative environment without splitting rendering in two. Adoption is viable per-host through the `TwigAdapter` seam: a container-first host could invert the bridge and hand the container's environment to the host instead, at which point the native bundle could own the `twig` service.

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance96

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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 ~4 days

Total

2

Last Release

21d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b266fbc7c6022e0bd39e3e1f06d75029dda33bae8d4a109d79824cb6f3bbf18?d=identicon)[dennisenderink](/maintainers/dennisenderink)

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

![](https://www.gravatar.com/avatar/25ddb3567dc50c66226060bf3be9ea79e580f8c16852a021f2b0c007af75d06f?d=identicon)[tmdk](/maintainers/tmdk)

---

Top Contributors

[![tmdk](https://avatars.githubusercontent.com/u/690621?v=4)](https://github.com/tmdk "tmdk (6 commits)")[![dennisenderink](https://avatars.githubusercontent.com/u/329734?v=4)](https://github.com/dennisenderink "dennisenderink (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.2k](/packages/craftcms-cms)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19566.0M1.8k](/packages/drupal-core)[october/rain

October Rain Library

1601.7M88](/packages/october-rain)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M605](/packages/shopware-core)[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)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k64](/packages/open-dxp-opendxp)

PHPackages © 2026

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