PHPackages                             hypejunction/hypetwig - 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. hypejunction/hypetwig

AbandonedArchivedElgg-plugin[Templating &amp; Views](/categories/templating)

hypejunction/hypetwig
=====================

Twig template integration

1.1.1(7y ago)115proprietaryPHPPHP &gt;=5.5

Since Jul 2Pushed 7y ago1 watchersCompare

[ Source](https://github.com/hypeJunction/Elgg3-hypeTwig)[ Packagist](https://packagist.org/packages/hypejunction/hypetwig)[ Docs](http://hypejunction.com)[ RSS](/packages/hypejunction-hypetwig/feed)WikiDiscussions master Synced today

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

hypeTwig
========

[](#hypetwig)

[![Elgg 3.0](https://camo.githubusercontent.com/6a26ca1c817393b931b8e9da8e3b98241c91a81b64ff2f26f164af94d59a8f1d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f456c67672d332e302e782d6f72616e67652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/6a26ca1c817393b931b8e9da8e3b98241c91a81b64ff2f26f164af94d59a8f1d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f456c67672d332e302e782d6f72616e67652e7376673f7374796c653d666c61742d737175617265)

Adds support for twig templates in Elgg

Using Templates
---------------

[](#using-templates)

To add a twig template, simply add a file with `.twig` extension into your plugin's views, under `default` viewtype.

```

{{ Hello, {{ name }}
```

To render a template use ``elgg\_twig()`:

```
$user = elgg_get_logged_in_user_entity();

echo elgg_twig('test', ['name' => $user->getDispayName()];
```

You can override templates like any other view, but you can not extend them or filter them using hooks.

Development
-----------

[](#development)

To simplify development, set `environment` config value to `development`, otherwise you need to flush caches to reload template changes.

```
elgg_set_config('environment', 'development');
```

Globals
-------

[](#globals)

Globals available in templates

- `app` - application data

    - `app.user` - logged in user entity
    - `app.site` - site entity
    - `app.registrationUrl` - registration URL
    - `app.loginUrl` - login URL
- `faker` - fake data generator ()

Functions
---------

[](#functions)

Function available in templates

- `echo()` - equivalent of `elgg_echo()`
- `view()` - equivalent of `elgg_view()`
- `assetUrl()` - equivalent of `elgg_get_simplecache_url()`
- `requireJs()` - equivalent of `elgg_require_js()`
- `formatHtml()` - equivalent of `elgg_format_html()`
- `menu()` - equivalent of `elgg_view_menu()`

Notes
-----

[](#notes)

I have initially taught `elgg_view()` to render twig templates, but it had a negative performance impact, likely because of a `view_vars` hook registered for all views. Until there is a wildcard hook registration, `elgg_twig()` is the way to go, however it does not allow view vars to be filtered or views to be extended, which in the end is somewhat a win, because of simplicity.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

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

Total

3

Last Release

2864d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5071b1cd852e094b3f564962a625e04c227adc73af30c5b46b243ab8f20154a7?d=identicon)[hypeJunction](/maintainers/hypeJunction)

---

Top Contributors

[![hypeJunction](https://avatars.githubusercontent.com/u/1202761?v=4)](https://github.com/hypeJunction "hypeJunction (6 commits)")

---

Tags

plugintwigelggtemplates

### Embed Badge

![Health badge](/badges/hypejunction-hypetwig/health.svg)

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

###  Alternatives

[twig/extra-bundle

A Symfony bundle for extra Twig extensions

91292.0M313](/packages/twig-extra-bundle)[twig/intl-extra

A Twig extension for Intl

36663.2M218](/packages/twig-intl-extra)[twig/string-extra

A Twig extension for Symfony String

21946.0M132](/packages/twig-string-extra)[twig/cssinliner-extra

A Twig extension to allow inlining CSS

23018.5M53](/packages/twig-cssinliner-extra)[symfony/ux-twig-component

Twig components for Symfony

21814.8M161](/packages/symfony-ux-twig-component)[shoot/shoot

Shoot aims to make providing data to your templates more manageable

41229.9k2](/packages/shoot-shoot)

PHPackages © 2026

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