PHPackages                             smcgarrity/rhubarb-module-leaf-twigview - 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. [Framework](/categories/framework)
4. /
5. smcgarrity/rhubarb-module-leaf-twigview

ActiveLibrary[Framework](/categories/framework)

smcgarrity/rhubarb-module-leaf-twigview
=======================================

Twig integrated View for Rhubarb

1.0.0(8y ago)023Apache-2.0PHP

Since Mar 12Pushed 8y agoCompare

[ Source](https://github.com/smcgarrity/Module.Leaf.TwigView)[ Packagist](https://packagist.org/packages/smcgarrity/rhubarb-module-leaf-twigview)[ Docs](https://github.com/smcgarrity/Module.Leaf.TwigView)[ RSS](/packages/smcgarrity-rhubarb-module-leaf-twigview/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Module.Leaf.TwigView
--------------------

[](#moduleleaftwigview)

Integration of Twig HTML template engine in a Rhubarb View.

Creating a Twig View
--------------------

[](#creating-a-twig-view)

To create a twig view simply create a View that extends the TwigView class.

```
class ProductDetailsView extends TwigView
```

You will be have to implement two methods:

**getTwigFileLocation()** should return the location of your .twig or .html file as a string.

```
function getTwigFileLocation(): string
{
    return __DIR__ . '/File.twig';
}
```

**getTwigVariables()** returns an array of values you want to be available in your Twig Template.

```
function getTwigVariables() {
    return [
        'PageTitle' => 'Edit Page',
        'Type' => $this->model->restModel->Type,
        'NameInput' => $this->leaves['NameTextbox'],
    ];
}
```

You will also need an actual Twig File to be compiled. Twig can compile any HTML file, but has additional support for twig features such as controls and variables. To format twig inputs use the PHPStorm .twig file.

TwigView uses the printViewContent method to render the HTML so if you extend printViewContent ensure to include a parent call.

Using Twig
----------

[](#using-twig)

Twig uses brackets `{  }` to insert variables and controls into a HTML template.

A variable can be output directly using double brackets.

```
{{ date }}
```

Objects can be access with dot notation in the same way:

```
Dear {{ recipient.Name }},
```

Controls can be added using `{%  %}`.

```
{% for purchase in purchases  %}
    {% if purchase.cancelled %}
        You cancelled your purchase of a {{purchase.product}} on {{purchase.date}}
    {% else %}
         you purchased a {{purchase.product}} on {{purchase.date}} for {{purchase.price}}
    {% endif %}
{% endfor %}
```

Full Twig Documentation:

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

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

Unknown

Total

1

Last Release

3033d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/30289236?v=4)[Sean McGarrity](/maintainers/smcgarrity)[@smcgarrity](https://github.com/smcgarrity)

---

Top Contributors

[![smcgarrity](https://avatars.githubusercontent.com/u/30289236?v=4)](https://github.com/smcgarrity "smcgarrity (8 commits)")

---

Tags

phpframeworktwigpresenterrhubarbmvpleaf

### Embed Badge

![Health badge](/badges/smcgarrity-rhubarb-module-leaf-twigview/health.svg)

```
[![Health](https://phpackages.com/badges/smcgarrity-rhubarb-module-leaf-twigview/health.svg)](https://phpackages.com/packages/smcgarrity-rhubarb-module-leaf-twigview)
```

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[contao-community-alliance/dc-general

Universal data container for Contao

1579.5k91](/packages/contao-community-alliance-dc-general)

PHPackages © 2026

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