PHPackages                             takemo101/simple-templa - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. takemo101/simple-templa

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

takemo101/simple-templa
=======================

Simple Template Parser

v0.1.4(4y ago)12.6k1MITPHPPHP ^8.0

Since Feb 16Pushed 4y ago1 watchersCompare

[ Source](https://github.com/takemo101/simple-templa)[ Packagist](https://packagist.org/packages/takemo101/simple-templa)[ Docs](https://github.com/takemo101/simple-templa)[ RSS](/packages/takemo101-simple-templa/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (7)Used By (1)

Simple Template Parser
======================

[](#simple-template-parser)

[![Testing](https://github.com/takemo101/simple-templa/actions/workflows/testing.yml/badge.svg)](https://github.com/takemo101/simple-templa/actions/workflows/testing.yml)[![PHPStan](https://github.com/takemo101/simple-templa/actions/workflows/phpstan.yml/badge.svg)](https://github.com/takemo101/simple-templa/actions/workflows/phpstan.yml)[![Validate Composer](https://github.com/takemo101/simple-templa/actions/workflows/composer.yml/badge.svg)](https://github.com/takemo101/simple-templa/actions/workflows/composer.yml)

The Simple Templa is a simple template parser.
Enjoy!

How to use
----------

[](#how-to-use)

Please use as follows

### Basic

[](#basic)

```
use Takemo101\SimpleTempla\Environment\DefaultEnvironmentCreator;

// create Environment object
$environment = DefaultEnvironmentCreator::create();

// template text
$text = "
    Hello, i like {{ data.language|strtoupper }}.
    PHP is {{ data.php_is.simple|strtolower|ucfirst }} and {{ data.php_is.nice|strtolower }}.
    {{ data.thank_you.thank|ucfirst }} {{ data.thank_you.you }}

    {{ data }}
";

// create template object from text
$template = $environment->createTemplate($text);

// pass the data as an array
$result = $template->parse([
    'data' => [
        'language' => 'php',
        'php_is' => [
            'simple' => 'SIMPLE',
            'nice' => 'NICE',
        ],
        'thank_you' => [
            'thank' => 'thank',
            'you' => 'you',
        ],
    ],
]);

echo $result;
//    Hello, i like PHP.
//    PHP is Simple and nice.
//    Thank you.
//
//    {"language":"php","php_is":{"simple":"SIMPLE","nice":"NICE"},"thank_you":{"thank":"thank","you":"you"}}
```

### Filter

[](#filter)

You can add filters to the Enviroment Object

```
use Takemo101\SimpleTempla\Environment\DefaultEnvironmentCreator;
use Takemo101\SimpleTempla\Filter\ {
    FilterProcessInterface,
    FilterName,
    Filter,
};

/**
 * create test filter class
 */
final class TestFilter implements FilterProcessInterface
{
    public function __construct(
        private string $replaceText,
    )
    {
        //
    }

    // processing that returns only a specific character string
    public function execute(string $value): string
    {
        return $this->replaceText;
    }
}

// create Environment object
$environment = DefaultEnvironmentCreator::create();

// add preset filter
$environment->addPresetFilter(
    new Filter(
        new FilterName('test_filter'),
        new TestFilter('TEST'),
    ),
);

// template text
$text = "{{ test|test_filter }}";

// create template object from text
$template = $environment->createTemplate($text);

$result = $template->parse(['test' => '____']);

echo $result;
// TEST

$result = $template->parse(['test' => 'ABCD']);

echo $result;
// TEST
```

### Value processing

[](#value-processing)

You can process the value passed to the template with a function.

```
use Takemo101\SimpleTempla\Environment\DefaultEnvironmentCreator;
use Takemo101\SimpleTempla\Template\Value\Call;

// create Environment object
$environment = DefaultEnvironmentCreator::create();

// template text
$text = "{{ data }}";

// create template object from text
$template = $environment->createTemplate($text);

// create Call object
$call = new Call(fn ($v) => strtoupper($v));

// set the function to the value in the Call object
$result = $template->parse(['data' => $call->of('hello')]);

echo $result;
// HELLO

$result = $template->parse(['data' => $call->of('world')]);

echo $result;
// WORLD
```

### Template language

[](#template-language)

Only filters and variables are available in this template language.

expressionexamplevariables{{ data.first }} {{ data.second }}filters{{ data.first|strtolower }} {{ data.second|strtoupper }}

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70.8% 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 ~7 days

Total

5

Last Release

1513d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2139dffa0ff324f185e4afd76e1bfad1ff5270c4cf3eabe278dc353ea16aa84e?d=identicon)[takemo101](/maintainers/takemo101)

---

Top Contributors

[![hayama-kei](https://avatars.githubusercontent.com/u/73094141?v=4)](https://github.com/hayama-kei "hayama-kei (17 commits)")[![takemo101](https://avatars.githubusercontent.com/u/66665053?v=4)](https://github.com/takemo101 "takemo101 (7 commits)")

---

Tags

phpparserpackage

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/takemo101-simple-templa/health.svg)

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

###  Alternatives

[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k910.8M118](/packages/doctrine-lexer)[simplehtmldom/simplehtmldom

A fast, simple and reliable HTML document parser for PHP.

1921.3M14](/packages/simplehtmldom-simplehtmldom)[corveda/php-sandbox

A PHP library that can be used to run PHP code in a sandboxed environment

23483.5k2](/packages/corveda-php-sandbox)[leonelquinteros/php-toml

PHP parser for TOML language ( https://github.com/toml-lang/toml )

266.7k](/packages/leonelquinteros-php-toml)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)

PHPackages © 2026

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