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

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

alexmasterov/equip-twig
=======================

The Twig integration for the Equip framework

3.1.0(9y ago)0106MITPHPPHP ^7.0 || ^7.1

Since Jan 4Pushed 9y agoCompare

[ Source](https://github.com/AlexMasterov/equip-twig)[ Packagist](https://packagist.org/packages/alexmasterov/equip-twig)[ Docs](https://github.com/AlexMasterov/equip-twig)[ RSS](/packages/alexmasterov-equip-twig/feed)WikiDiscussions 2.0 Synced 3w ago

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

Equip Twig
----------

[](#equip-twig)

[![Latest Stable Version](https://camo.githubusercontent.com/d08add4eb45e772ab0e511e7078511fe9da533519e006f24f95165aeb0ec6b73/68747470733a2f2f706f7365722e707567782e6f72672f616c65786d61737465726f762f65717569702d747769672f762f737461626c65)](https://packagist.org/packages/alexmasterov/equip-twig)[![License](https://camo.githubusercontent.com/0a3dcc5c6feb3962000c2e06ce940bbdf107a1dfea34943a636c7d6a16b21769/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616c65786d61737465726f762f65717569702d747769672e737667)](https://github.com/AlexMasterov/equip-twig/blob/2.0/LICENSE)[![Build Status](https://camo.githubusercontent.com/b82f06fd812976b42c2da5d4daec1a380e392d3125dcf5f3857c231f522c5dd8/68747470733a2f2f7472617669732d63692e6f72672f416c65784d61737465726f762f65717569702d747769672e737667)](https://travis-ci.org/AlexMasterov/equip-twig)[![Code Coverage](https://camo.githubusercontent.com/0ad8dbbf278a2422ddd550eccf1d66c9eada6e079f8a255d79dae7956a80fe22/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f416c65784d61737465726f762f65717569702d747769672f6261646765732f636f7665726167652e706e673f623d322e30)](https://scrutinizer-ci.com/g/AlexMasterov/equip-twig/?branch=2.0)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/5996c004e44784816685571bde0ffd27c444065eac63d934c91ccc3aff086736/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f416c65784d61737465726f762f65717569702d747769672f6261646765732f7175616c6974792d73636f72652e706e673f623d322e30)](https://scrutinizer-ci.com/g/AlexMasterov/equip-twig/?branch=2.0)

The [Twig](http://twig.sensiolabs.org/) integration for the [Equip](http://equip.github.io/).

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

[](#installation)

The suggested installation method is via [composer](https://getcomposer.org/):

```
composer require alexmasterov/equip-twig:^2.0
```

Configuration
-------------

[](#configuration)

To use the [`TwigFormatter`](https://github.com/AlexMasterov/equip-twig/blob/2.0/src/TwigFormatter.php) implementation you need to add [`TwigResponderConfiguration`](https://github.com/AlexMasterov/equip-twig/blob/2.0/src/Configuration/TwigResponderConfiguration.php) into the [application bootstrap](https://equipframework.readthedocs.org/en/latest/#bootstrap):

```
Equip\Application::build()
->setConfiguration([
    // ...
    AlexMasterov\EquipTwig\Configuration\TwigResponderConfiguration::class
])
// ...
```

### Setting up the Twig environment:

[](#setting-up-the-twig-environment)

[Default configuration](https://github.com/equip/framework/blob/master/docs/index.md#dependency-injection-container), via dependency injector:

```
// src/Configuration/TwigConfiguration.php
namespace Acme\Configuration;

use Auryn\Injector;
use Equip\Env;
use Equip\Configuration\ConfigurationInterface;
use AlexMasterov\EquipTwig\Configuration\TwigResponderConfiguration;

class TwigConfiguration implements ConfigurationInterface
{
    public function apply(Injector $injector)
    {
        $twigEnv = new Env([
                'TWIG_TEMPLATES'        => __DIR__.'/../Resources/templates',
                'TWIG_CACHE'            => __DIR__.'/../../var/cache/twig',
                'TWIG_DEBUG'            => false,
                'TWIG_AUTO_RELOAD'      => true,
                'TWIG_STRICT_VARIABLES' => false,
                'TWIG_FILE_EXTENSIONS'  => 'html.twig,twig'
            ]);

        $injector->define(TwigResponderConfiguration::class, [
            ':env' => $twigEnv
        ]);
    }
}
```

```
Equip\Application::build()
->setConfiguration([
    // ...
    Acme\Configuration\TwigConfiguration::class,
    AlexMasterov\EquipTwig\Configuration\TwigResponderConfiguration::class
])
// ...
```

[Optional configuration](https://github.com/equip/framework/blob/master/docs/index.md#setting-the-env-file), via a `.env` file:

```
TWIG_TEMPLATES = "../Resources/templates"
TWIG_CACHE = "../var/cache/twig"
TWIG_DEBUG = false
TWIG_AUTO_RELOAD = true
TWIG_STRICT_VARIABLES = false
TWIG_FILE_EXTENSIONS = "html.twig,twig"
```

Usage
-----

[](#usage)

Basic example:

```
namespace Acme\Domain;

use Equip\Adr\DomainInterface;
use Equip\Adr\PayloadInterface;

class WidgetDomain implements DomainInterface
{
    /**
     * @var PayloadInterface
     */
    private $payload;

    public function __construct(PayloadInterface $payload)
    {
        $this->payload = $payload;
    }

    public function __invoke(array $input)
    {
        return $this->payload
            ->withStatus(PayloadInterface::STATUS_OK)
            ->withSetting('template', 'widget.html.twig')
            ->withOutput([
                'message' => 'Just do it!'
            ]);
    }
}
```

Using [`PayloadRenderTrait`](https://github.com/AlexMasterov/equip-twig/blob/2.0/src/Payload/PayloadRenderTrait.php) as wrapper for the usual `render` method:

```
// ...
use AlexMasterov\EquipTwig\Payload\PayloadRenderTrait;

class WidgetDomain implements DomainInterface
{
    use PayloadRenderTrait;

    public function __invoke(array $input)
    {
        $message = 'Just do it!';
        return $this->render('widget.html.twig', compact('message'));
    }
}
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Total

7

Last Release

3460d ago

Major Versions

1.0.0 → 3.0.02017-01-04

1.0.x-dev → 3.1.02017-01-07

PHP version history (2 changes)2.0.0PHP &gt;=5.5.9

3.1.0PHP ^7.0 || ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c3a759788edb549b16d53cc92214268ed89b6dbaa8dfa7025c3b5389bd34edf?d=identicon)[AlexMasterov](/maintainers/AlexMasterov)

---

Top Contributors

[![AlexMasterov](https://avatars.githubusercontent.com/u/700213?v=4)](https://github.com/AlexMasterov "AlexMasterov (119 commits)")

---

Tags

equip-frameworkequip-twigtwigformattertwigrendererequip

### Embed Badge

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

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

###  Alternatives

[timber/timber

Create WordPress themes with beautiful OOP code and the Twig Template Engine

5.7k3.6M127](/packages/timber-timber)[twig/intl-extra

A Twig extension for Intl

36567.2M320](/packages/twig-intl-extra)[symfony/ux-twig-component

Twig components for Symfony

22017.2M313](/packages/symfony-ux-twig-component)[symfony/ux-live-component

Live components for Symfony

1636.5M115](/packages/symfony-ux-live-component)[twig/cssinliner-extra

A Twig extension to allow inlining CSS

22919.7M81](/packages/twig-cssinliner-extra)[twig/inky-extra

A Twig extension for the inky email templating engine

16613.2M70](/packages/twig-inky-extra)

PHPackages © 2026

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