PHPackages                             corex/template - 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. corex/template

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

corex/template
==============

Simple template system

2.1.0(6y ago)0941MITPHPPHP ^7.2

Since Sep 13Pushed 6y agoCompare

[ Source](https://github.com/corex/template)[ Packagist](https://packagist.org/packages/corex/template)[ RSS](/packages/corex-template/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (7)Used By (1)

Simple template system.
=======================

[](#simple-template-system)

[![License](https://camo.githubusercontent.com/ed61c0892c96b495e54ecf719223f3cf5afe822c63d3878af4a3494a6aa29612/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f7265782f74656d706c6174652e737667)](https://camo.githubusercontent.com/ed61c0892c96b495e54ecf719223f3cf5afe822c63d3878af4a3494a6aa29612/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f7265782f74656d706c6174652e737667)[![Build Status](https://camo.githubusercontent.com/0d376cc81603aed7ab0e98d113c56fd0e0744ae6cab7d7e005c3361b6414a526/68747470733a2f2f7472617669732d63692e6f72672f636f7265782f74656d706c6174652e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/0d376cc81603aed7ab0e98d113c56fd0e0744ae6cab7d7e005c3361b6414a526/68747470733a2f2f7472617669732d63692e6f72672f636f7265782f74656d706c6174652e7376673f6272616e63683d6d6173746572)[![codecov](https://camo.githubusercontent.com/b7cb2b8465241ec58cb245bd44c8131d25d1a56719f7b73590bd8ade43834ff6/68747470733a2f2f636f6465636f762e696f2f67682f636f7265782f74656d706c6174652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://camo.githubusercontent.com/b7cb2b8465241ec58cb245bd44c8131d25d1a56719f7b73590bd8ade43834ff6/68747470733a2f2f636f6465636f762e696f2f67682f636f7265782f74656d706c6174652f6272616e63682f6d61737465722f67726170682f62616467652e737667)

The goal for this package is simplicity. It is based on Mustache but has a very simple approach. If you need more than this "simplicity", Mustache is recommended.

Every call to load() and render() will use base paths.

Mustache is default set to escape variables. This has been disabled on this package. It is however possible to escape by calling escape() on template if you need to escape values i.e. html-tags.

Note: when printing layout/view (\_\_toString) and exception is thrown, it will be caught and send through error\_log().

```
// Set base path (can be called more than once). Paths will be searched in reverse order.
Template::basePath('/path/to/templates');
Template::basePath('/path/to/other/templates');
```

```
// Load template.
$template = Template::load('test');

// Set escape on variables (default un-escaped).
$template->escape();

// Set path for templates.
$template->path('/path/to/some/other/templates');

// Set variable on template.
$template->variable('myVar', 'myValue');
$template->var('myVar2', 'myValue2');

// Set variables.
$template->variables([
    'myVar1' => 'myValue1',
    'myVar2' => 'myValue2'
]);
$template->vars([
    'myVar3' => 'myValue3',
    'myVar4' => 'myValue4'
]);

// Render template.
$content = $template->render();
```

```
// Example of loading template, set var and render.
$content = Template::load('base')
    ->variable('myVar', 'myValue')
    ->var('myVar2', 'myValue2')
    ->render();
```

```
// Render template directly.
$content = Template::render('base', [
    'myVar1' => 'myValue1',
    'myVar2' => 'myValue2'
]);
```

```
// Parse template and render values.
$content = Template::parse('({{myVar}})', ['myVar' => 'myValue']);
```

```
// Get Mustache engine.
$mustacheEngine = Template::mustacheEngine();
```

For further reading on Mustache, look at

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

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

Total

5

Last Release

2500d ago

Major Versions

1.0.0 → 2.0.02018-12-09

PHP version history (2 changes)1.0.0PHP &gt;=7.0

2.0.0PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/2168107cb28f49e937f963a925553ebac5923aa27cad2e1cf90ddbcabf663d6d?d=identicon)[corex](/maintainers/corex)

---

Top Contributors

[![corex](https://avatars.githubusercontent.com/u/21259173?v=4)](https://github.com/corex "corex (11 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/corex-template/health.svg)

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

###  Alternatives

[wrklst/docxmustache

docx template manipulation class, based on mustache templating language

578.1k](/packages/wrklst-docxmustache)[zombor/kostache

Logic-less View/Mustache Module for the Kohana Framework

1382.1k2](/packages/zombor-kostache)[bobthecow/mustache-bundle

Symfony Mustache.php Bundle

1886.1k](/packages/bobthecow-mustache-bundle)[mustache/silex-provider

A Mustache service provider for Silex.

1462.4k1](/packages/mustache-silex-provider)[dearon/slim-mustache

Mustache View Parser package for the Slim Framework

144.9k2](/packages/dearon-slim-mustache)

PHPackages © 2026

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