PHPackages                             activecollab/templateengine - 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. activecollab/templateengine

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

activecollab/templateengine
===========================

Component that abstracts template engines and offers easy to use PHP template engine

4.0.0(2mo ago)016.9k—0%1MITPHPPHP &gt;=8.1CI failing

Since May 22Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/activecollab/templateengine)[ Packagist](https://packagist.org/packages/activecollab/templateengine)[ RSS](/packages/activecollab-templateengine/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (1)

Template Engine
===============

[](#template-engine)

[![Build Status](https://camo.githubusercontent.com/b04689d13bf9199be3a206bfa960cf650d7eb75ec21d1392886862b111f55092/68747470733a2f2f7472617669732d63692e6f72672f616374697665636f6c6c61622f74656d706c617465656e67696e652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/activecollab/templateengine)

This package offers a single interface for interaction with multiple template engines. It ships with simple PHP template engine built in:

```
$template_engine = new PhpTemplateEngine('/path/to/templates/dir');

// Set attributes that will be passed to all templates. Method chaining is supported.
$template_engine->setAttributes([
    'app_name' => 'My Awesome App',
    'app_version' => '1.0.0',
])->addAttribute('app_env', 'staging');

// Render template to output buffer
$template_engine->display('/mail/hello.php', ['first_name' => 'John'])

// Render template and return output as a string
$output = $template_engine->fetch('/mail/hello.php', ['first_name' => 'John'])
```

Template Sandboxing
-------------------

[](#template-sandboxing)

Templates are sandboxed, and can be placed only in templates directory that is specified when engine is constructed. If you try to use a template that is not in this directory, template engine will throw a `\RuntimeException`:

```
$template_engine->fetch('/example/../../../../etc/passwd'); // Will throw an exception
```

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance84

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity76

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

Every ~889 days

Total

5

Last Release

82d ago

Major Versions

1.0.1 → 2.0.02019-12-23

2.0.0 → 3.0.02024-01-23

3.0.0 → 4.0.02026-02-16

PHP version history (4 changes)1.0.0PHP &gt;=5.6.0

2.0.0PHP &gt;=7.3

3.0.0PHP &gt;=8.0

4.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/729914?v=4)[Ilija Studen](/maintainers/ilijastuden)[@ilijastuden](https://github.com/ilijastuden)

---

Top Contributors

[![ilijastuden](https://avatars.githubusercontent.com/u/729914?v=4)](https://github.com/ilijastuden "ilijastuden (20 commits)")

---

Tags

templateview

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/activecollab-templateengine/health.svg)

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

###  Alternatives

[eftec/bladeone

The standalone version Blade Template Engine from Laravel in a single php file

8208.4M87](/packages/eftec-bladeone)[jenssegers/blade

The standalone version of Laravel's Blade templating engine for use outside of Laravel.

8661.2M107](/packages/jenssegers-blade)[wyrihaximus/twig-view

Twig powered View for CakePHP

804.7M1](/packages/wyrihaximus-twig-view)[anourvalar/office

Generate documents from existing Excel &amp; Word templates | Export tables to Excel (Grids)

24085.2k](/packages/anourvalar-office)[ytake/laravel-smarty

Smarty template engine for Laravel and Lumen

87401.6k](/packages/ytake-laravel-smarty)[aura/view

Provides an implementation of the TemplateView and TwoStepView patterns, with support for helpers and for closures as templates, using PHP itself as the templating language.

88152.8k19](/packages/aura-view)

PHPackages © 2026

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