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

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

stratify/twig-module
====================

Twig module for Stratify

0.3.1(8y ago)0667MITPHP

Since Aug 30Pushed 8y ago2 watchersCompare

[ Source](https://github.com/stratifyphp/twig-module)[ Packagist](https://packagist.org/packages/stratify/twig-module)[ RSS](/packages/stratify-twig-module/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (4)Versions (11)Used By (0)

Twig module for Stratify
========================

[](#twig-module-for-stratify)

Pre-configuration for Twig to work with Stratify.

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

[](#installation)

```
composer require stratify/twig-module

```

Then enable the `stratify/twig-module` module in your Stratify application.

Usage
-----

[](#usage)

The `Twig_Environment` instance is now injectable wherever dependency injection is available.

Example of a Stratify controller:

```
function (Twig_Environment $twig) {
    return $twig->render('home.twig');
}
```

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

[](#configuration)

The following configuration options can be customized if needed:

- `twig.paths`: Paths containing templates to register

    ```
    'twig.paths' => add([
        __DIR__.'/../views',
    ]),
    ```

    Templates can then be rendered as `foo.twig`.

    Templates can also be namespaced, which can be useful for reusable modules:

    ```
    'twig.paths' => add([
        'blog' => __DIR__.'/../views',
    ]),
    ```

    Templates can then be rendered as `@blog/foo.twig`.
- `twig.options`: [Twig options](http://twig.sensiolabs.org/doc/api.html#environment-options)

    ```
    'twig.options' => add([
        'strict_variables' => true,
    ]),
    ```
- `twig.globals`: [Global variables available in templates](http://twig.sensiolabs.org/doc/advanced.html#id1)

    ```
    'twig.globals' => add([
        'appName' => 'My super project',
        'debug' => get('debug'), // container parameters can be injected too
    ]),
    ```
- `twig.extensions`: array of [Twig extensions](http://twig.sensiolabs.org/doc/api.html#using-extensions)

    ```
    'twig.extensions' => add([
        get(Twig_Extension_Profiler::class),
        get(My\Custom\TwigExtension::class),
    ]),
    ```

Recommended options for **production**:

```
'twig.options' => [
    'cache' => /* cache directory */,
],
```

Recommended options for **development**:

```
'twig.options' => [
    'debug' => true,
    'cache' => false,
    'strict_variables' => true,
],
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

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

Recently: every ~134 days

Total

10

Last Release

3071d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/329a6111724074f5388e95dd41a03ccf3c43f4bfe1ecf27c94c9efc6f7823228?d=identicon)[mnapoli](/maintainers/mnapoli)

---

Top Contributors

[![mnapoli](https://avatars.githubusercontent.com/u/720328?v=4)](https://github.com/mnapoli "mnapoli (24 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[mati365/ckeditor5-symfony

CKEditor 5 integration for Symfony

262.6k](/packages/mati365-ckeditor5-symfony)

PHPackages © 2026

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