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

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

futape/simple-template
======================

A damn simple template engine

1.0.0(6y ago)02MITPHPPHP ~7.2.0CI failing

Since Nov 24Pushed 6y ago1 watchersCompare

[ Source](https://github.com/futape/simple-template)[ Packagist](https://packagist.org/packages/futape/simple-template)[ RSS](/packages/futape-simple-template/feed)WikiDiscussions master Synced 5d ago

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

futape/simple-template
======================

[](#futapesimple-template)

This library offers a very simple template engine.

The engine's only function is to resolve placeholders in the template to defined variable values or PHP constants.

Install
-------

[](#install)

```
composer require futape/simple-template
```

Usage
-----

[](#usage)

```
use Futape\SimpleTemplate\Template;

$template = (new Template(
    "Hello {{\$name}},\n\nthis is an usage example of futape/simple-template.\nYour installed PHP version is " .
        "{{PHP_VERSION}}."
))
    ->addVariable('name', 'Stranger');

echo $template->render();
/* Hello Stranger,

this is an usage example of futape/simple-template.
Your installed PHP version is 7.2.0. */
```

Placeholders may be escaped using a `\` in front of the second `{`.
`{\{$foo}}` would result in `{{$foo}}` (or `{\{$foo}}` if the `unescapePlaceholders` config is disabled).

The engine can be configured, either via a constructor's second argument or by calling `setConfig()`.
The following configuration options exist:

NameTypeDefaultDescriptionunescapePlaceholdersbooltrueIf `\` characters used to escape placeholders should be removed from the rendered templateresolveConstantsbooltrueIf resolving placeholders to constants is enableddiscardUndefinedVariablesbooltrueIf unresolvable placeholders should be removed from the rendered templateTesting
-------

[](#testing)

The library is tested by unit tests using PHP Unit.

To execute the tests, install the composer dependencies (including the dev-dependencies), switch into the `tests`directory and run the following command:

```
../vendor/bin/phpunit
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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

2365d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2039b7c5a64766be0d130dbd8f7cfa4e3863c3c8b54eca6466c0974311fe6ccd?d=identicon)[futape](/maintainers/futape)

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  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)
