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

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

barefootjs/twig
===============

Twig rendering backend for the BarefootJS PHP runtime (barefootjs/php) -- TwigBackend implements the engine backend contract on an autoescaping Twig\\Environment, ported from packages/adapter-perl/lib/BarefootJS/Backend/\*.pm (see also the packages/adapter-jinja/python port's JinjaBackend).

v0.31.5(2w ago)070↓62.5%MITPHP &gt;=8.2

Since Jul 7Compare

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

READMEChangelogDependencies (8)Versions (37)Used By (0)

barefootjs/twig
===============

[](#barefootjstwig)

Twig rendering backend (`Barefoot\TwigBackend`) for the BarefootJS PHP runtime.

This package targets `twig/twig` and pairs with the `@barefootjs/twig`compile-time adapter, which emits `.twig` templates that call the runtime as a `bf` object (`{{ bf.scope_attr() }}`, `{{ bf.json(x) }}`, `{{ bf.spread_attrs(bag) }}`).

The engine-agnostic runtime itself (`Barefoot\BarefootJS`, `Evaluator`, `SearchParams`, `Json`) lives in a separate package, [`packages/adapter-php`](../../adapter-php) (`barefootjs/php` on Composer) -- see that package's README for the backend contract every PHP engine adapter (Twig, Blade, ...) implements.

This package is maintained in the BarefootJS monorepo and is mirrored to a Packagist-facing repository only for Composer distribution.

- Source of truth:
- Monorepo:
- npm adapter: `@barefootjs/twig`
- Runtime dependency: `barefootjs/php` (`packages/adapter-php`)

Do not send implementation pull requests to the Packagist mirror. Send changes to the monorepo path above; the release workflow splits this directory and pushes the mirror automatically.

Tests
-----

[](#tests)

```
php tests/test_render.php
```

A live end-to-end Twig render (scope markers, hydration attrs, text slots, autoescaping, `spread_attrs`, reserved-word mangling). Needs `twig/twig`installed (`composer install`); skips gracefully with a notice (not a failure) when `vendor/autoload.php` is absent. The engine-agnostic runtime's own test suite (golden helper vectors, evaluator vectors, `spread_attrs`, `omit`, `render_child`, ...) lives in [`packages/adapter-php/tests`](../../adapter-php/tests) — run with `php packages/adapter-php/tests/run.php`.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance98

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

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

Total

36

Last Release

14d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/117d4ea26adf7bef9f927827a04bb085bbced6aa5e0bd63464c334c5c71a49e3?d=identicon)[kfly8](/maintainers/kfly8)

### Embed Badge

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

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.7M3.4k](/packages/craftcms-cms)[symfony/ux-live-component

Live components for Symfony

1657.5M154](/packages/symfony-ux-live-component)

PHPackages © 2026

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