PHPackages                             memio/twig-template-engine - 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. memio/twig-template-engine

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

memio/twig-template-engine
==========================

Memio's Twig templates, used to generate PHP code from given Model

v4.0.0(3mo ago)4312.6k↓30.8%6[1 issues](https://github.com/memio/twig-template-engine/issues)4MITPHPPHP ^8.0CI passing

Since Apr 28Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/memio/twig-template-engine)[ Packagist](https://packagist.org/packages/memio/twig-template-engine)[ Docs](http://memio.github.io/memio)[ RSS](/packages/memio-twig-template-engine/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (28)Used By (4)

Memio's TwigTemplateEngine
==========================

[](#memios-twigtemplateengine)

Memio is a highly opinionated PHP code generator library. It is composed of small independent packages, one being `PrettyPrinter`: the actual code generator.

`PrettyPrinter` relies on an interface, `TemplateEngine`, but doesn't provide any implementation to avoid direct coupling to any templating libraries.

This package, `TwigTemplateEngine`, provides an implementation and templates for [Twig](http://twig.sensiolabs.org).

> **Note**: This package is part of [Memio](http://memio.github.io/memio). Have a look at [the main repository](http://github.com/memio/memio).

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

[](#installation)

Install it using [Composer](https://getcomposer.org/download):

```
composer require memio/twig-template-engine:^3.0
```

Example
-------

[](#example)

We're going to generate a class with a constructor and two attributes:

```
