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

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

appt/twig
=========

Integrate Twig with ZF2.

1.0.0(13y ago)2101PHPPHP &gt;=5.3.0

Since Mar 18Pushed 9y ago1 watchersCompare

[ Source](https://github.com/alexshelkov/ApptTwig)[ Packagist](https://packagist.org/packages/appt/twig)[ Docs](https://github.com/alexshelkov/ApptTwig)[ RSS](/packages/appt-twig/feed)WikiDiscussions master Synced yesterday

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

Integrate Twig with ZF2.

[![Build Status](https://camo.githubusercontent.com/d688ab7cb25be1f5099a87d39d904dca7f983b86022c7bb29a003c93041761f5/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f616c65787368656c6b6f762f41707074547769672e706e67)](http://travis-ci.org/alexshelkov/ApptTwig)

---

#### Install

[](#install)

##### Using composer

[](#using-composer)

Add following in your composer.json:

```
{
    "require": {
        "appt/twig": "1.*"
    }
}
```

And enable module in your application.config.php:

```
return array(
    'modules' => array(
        'ApptTwig',
    )
);
```

---

#### Usage

[](#usage)

##### Configuration

[](#configuration)

###### Templates

[](#templates)

ApptTwig support adding templates using common for Zend Framework 2 TemplateMapResolver and TemplatePathStack loaders.

```
return array(
    'appt' => array(
        'twig' => array(
            'default_template_suffix' => 'twg', // you can change file extension used by TemplatePathStack
            'template_path_stack' => array(
                'dir/1/',
                'dir/2/'
            ),
            'template_map' => array(
                'layout/layout' => 'dir/layout.twig',
                'error' => __DIR__ . 'dir/error.twig',
            ),
        ),
    ),
);
```

###### Twig options

[](#twig-options)

You can change twig engine option in config:

```
return array(
 'appt' => array(
        'twig' => array(
            'engine_options' => array(
                'debug' => true, // turn on debug mode
            )
        ),
    ),
);
```

###### Twig extensions

[](#twig-extensions)

Also it is possible to add new twig extensions:

```
return array(
    'appt' => array(
        'twig' => array(
            'extension_manager' => array(
                'factories' => array (
                    'ZendViewHelpers' => 'ApptTwig\Service\Extension\ZendViewHelpersFactory'
                )
            ),
        )
    )
);
```

All extensions must implement Twig\_ExtensionInterface.

##### Provided services

[](#provided-services)

ApptTwig provide following services:

**appt.twig.renderer** -- renderer service compatible with PhpRenderer; **appt.twig.renderer\_strategy** -- renderer strategy;
**appt.twig.resolver** -- resolver service extend Zend\\View\\Resolver\\AggregateResolver and used for resolving templates; **appt.twig.extension\_manager** -- used for managing twig extensions, it extend Zend\\ServiceManager\\AbstractPluginManager.

##### Rendering

[](#rendering)

When you setup resolvers in your config ApptTwig is ready for rendering view templates as it was regular PhpRenderer. All you need is create templates in your view directory.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

4856d ago

### Community

Maintainers

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

---

Top Contributors

[![alexshelkov](https://avatars.githubusercontent.com/u/1233347?v=4)](https://github.com/alexshelkov "alexshelkov (18 commits)")

---

Tags

twigzend framework 2

### Embed Badge

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

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

###  Alternatives

[symfony/ux-twig-component

Twig components for Symfony

22018.6M356](/packages/symfony-ux-twig-component)[symfony/ux-live-component

Live components for Symfony

1647.0M127](/packages/symfony-ux-live-component)[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)[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)
