PHPackages                             skrz/templating-engine - 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. skrz/templating-engine

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

skrz/templating-engine
======================

Like Smarty, but faster

v1.1.6(5y ago)134.6kMITPHPCI failing

Since Aug 13Pushed 5y ago3 watchersCompare

[ Source](https://github.com/skrz/templating-engine)[ Packagist](https://packagist.org/packages/skrz/templating-engine)[ RSS](/packages/skrz-templating-engine/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (3)Versions (10)Used By (0)

Skrz.cz templating engine
=========================

[](#skrzcz-templating-engine)

Like Smarty, but faster

Why?
----

[](#why)

At [Skrz.cz](http://skrz.cz/), the largest Czech best-prices search engine, we heavily use [Smarty](http://www.smarty.net/). However, Smarty's official implementation ceased to meet our needs, mainly regarding performance.

`Skrz\Templating\Engine` is Smarty syntax-compatible. Not every Smarty construct has been implemented. You can think of what has been implemented as *the good parts*.

Key design decisions are:

- Compile time and run time are strictly separated. When you do `->display(...)`, or `->fetch(...)` in Smarty, many things can happen. Smarty checks if the template has been compiled, if compiled code is still valid, if cached content hasn't been hit, etc. `Skrz\Templating\Engine` does none of that.
- Compilation is managed by external tool. At Skrz we use [Grunt](http://gruntjs.com/) to compile CSS, Javascript, and also templates in development.
- Compilation output is an autoload-able class, rendering should be encapsulated in a method. Smarty compiles templates into a bunch of functions that reside inside `if` statements, so they cannot be declared twice. With JIT-ing PHP implementations coming up (HHVM, PHP-NG, HippyVM), this is quite sub-optimal, because certain optimizations cannot be applied (e.g. HHVM can optimize file inclusion that only contains classes at the top level, into just populating class tables).

Usage
-----

[](#usage)

`Skrz\Templating\Engine` provides only parser and compiler. Please refer to tests on how they are used.

Basically, you just create `ParserContext`, parse template file, create `CompilerContext`, and compile into output file.

Let's say, you have template `MyTemplate.tpl` in current directory and want to compile it into `MyTemplate.php`:

```
$outputFileName = __DIR__ . "/MyTemplate.php";

$parserContext = new ParserContext();
$parserContext
    ->addPath(__DIR__);
    ->setFile("MyTemplate.tpl");

$compilerContext = new CompilerContext();
$compilerContext
    ->setParserContext($parserContext)
    ->setClassName("MyTemplate")
    ->setTemplate($parserContext->parse())
    ->setOutputFileName($outputFileName)
    ->dump();

```

License
-------

[](#license)

The MIT license. See `LICENSE` file.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

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

Recently: every ~554 days

Total

9

Last Release

1934d ago

Major Versions

v0.1.0 → v1.0.02014-08-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/a9a85a90ea8b2060137fbfb3baaf7604c0681d27022331e090fd42401d578880?d=identicon)[Skrz](/maintainers/Skrz)

---

Top Contributors

[![jakubkulhan](https://avatars.githubusercontent.com/u/95001?v=4)](https://github.com/jakubkulhan "jakubkulhan (6 commits)")[![mzstic](https://avatars.githubusercontent.com/u/4610204?v=4)](https://github.com/mzstic "mzstic (4 commits)")[![lumitor2](https://avatars.githubusercontent.com/u/452988?v=4)](https://github.com/lumitor2 "lumitor2 (1 commits)")[![ssteklik](https://avatars.githubusercontent.com/u/15930629?v=4)](https://github.com/ssteklik "ssteklik (1 commits)")

---

Tags

templatingtemplatesfastsmartytemplate enginetemplating engine

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/skrz-templating-engine/health.svg)

```
[![Health](https://phpackages.com/badges/skrz-templating-engine/health.svg)](https://phpackages.com/packages/skrz-templating-engine)
```

###  Alternatives

[league/plates

Plates, the native PHP template system that's fast, easy to use and easy to extend.

1.5k6.2M268](/packages/league-plates)[laminas/laminas-view

Fast and type safe HTML templating library with a flexible plugin system supporting multistep template composition

7528.4M266](/packages/laminas-laminas-view)[foil/foil

PHP template engine for native PHP templates

170112.7k10](/packages/foil-foil)[noiselabs/smarty-bundle

This Symfony bundle provides integration for the Smarty3 template engine.

53196.2k1](/packages/noiselabs-smarty-bundle)[mobicms/render

Native PHP template engine

107.0k1](/packages/mobicms-render)

PHPackages © 2026

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