PHPackages                             reestyle/templateerphp - 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. reestyle/templateerphp

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

reestyle/templateerphp
======================

Simple PHP templating system

0.2(5y ago)04UnlicensePHPPHP &gt;=5.6

Since Sep 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ReeStyle/templateerphp)[ Packagist](https://packagist.org/packages/reestyle/templateerphp)[ RSS](/packages/reestyle-templateerphp/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (3)Used By (0)

TemplateerPHP
=============

[](#templateerphp)

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

[](#installation)

Either download the files or use composer to install.

`$ composer require reestyle/templateerphp`

Usage
-----

[](#usage)

### FYI

[](#fyi)

Templates can be anywhere relative to the folder set with `setBaseDir`. Going outside that scope is possible (there is no limitation), but then you'd need to remember or guess the folder path down to the double dot (..). Templates must end with `.phtml`.

As a form of 'protection', templates are loaded inside in a lambda function. Thus the TemplateerPHP class' private and protected properties and methods are *invisible* to the template. You can only access the public methods of the class.

---

### 'Controller' code

[](#controller-code)

Basic usage when calling templates:

```
    $templateer = new TemplateerPHP();

    $data = array_merge($this->data, [
        'pageTitle' => 'Hello Page!',
        'content' => 'Hello World!',
    ]);

    $viewHelpers = [
        'UrlHelper',
        'PageContentHelper',
    ]
    foreach ($viewHelpers as $helper) {
        $templateer->addHelper($helper);
    }

    $templateer
        ->setLayout('layout/default')
        ->setBaseDir(__DIR__)
        ->assign($data);

    $html = $templateer
        ->setImplicitLayout(true)
        ->render($this->getResource(), false);
```

---

### Helpers

[](#helpers)

A template helper is registered by its 'lowercased' name. E.g. PageContentHelper would become pagecontenthelper.

A helper should contain the magic method \_\_invoke(). In the template you can address them like:

```

```

You can return whatever you'd like from \_\_invoke(). Here also is no limitation.

---

\###Template code

Use shorthands in templates.

Basic template:

```

```

Would produce:

```
   Hello Page!

   Hello world!
```

---

### Partials / inserts

[](#partials--inserts)

Using partials (or inserts) is easy too:

```

```

You don't need to add `.phtml`. The partial renderer assumes it.

The partial may look like this:

```

```

To output something like this:

```
   val1
```

License
-------

[](#license)

The Unlicense. Free to use, alter, distribute, even make money, either personal or commercial.

See LICENSE file for specifics. Or don't... You may use it in any way you want anyway.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

Total

2

Last Release

2084d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/86612611192659fa69deddc8509eb774edd662a8b32b79ee6fd780b6c5a5262a?d=identicon)[reestyle-it](/maintainers/reestyle-it)

---

Top Contributors

[![reestyle-it](https://avatars.githubusercontent.com/u/1517435?v=4)](https://github.com/reestyle-it "reestyle-it (5 commits)")

### Embed Badge

![Health badge](/badges/reestyle-templateerphp/health.svg)

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

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)

PHPackages © 2026

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