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

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

gelembjuk/templating
====================

Common interface for different PHP templating engines like Smarty,Twig. This package allows to switch between engines witout changes in your PHP code

1.0.7(10y ago)01252MITPHP

Since Jul 28Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Gelembjuk/templating)[ Packagist](https://packagist.org/packages/gelembjuk/templating)[ RSS](/packages/gelembjuk-templating/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (9)Used By (2)

Gelembjuk/Templating
--------------------

[](#gelembjuktemplating)

Common interface for different PHP templating engines like Smarty, Twig. This package allows to switch between engines witout changes in your PHP code.

The package was created to be able to migrate to different popular PHP templating engines without need to change my application code. However, it is still needed to modify templates.

### Installation

[](#installation)

Using composer: [gelembjuk/templating](http://packagist.org/packages/gelembjuk/templating) `require: {"gelembjuk/templating": "1.*"}`

Additionally, you have to install a template engine you want to use - smarty/smarty or twig/twig (later i hope to add support of other engines).

### Configuration

[](#configuration)

Configuration is done in run time with a constructor options (as hash argument)

```
$templateroptions = array(
		'templatepath' => $templatesdir, // directory where templates are stored
		'compiledir' => $compiledir,    // directory to use for compilation temp files. It is needed fro Smarty, but not Twig
		'usecache' => false,       // don't cache . If true then use cache
		'cachedir' => $cachedir,   // path to cache directory. used if `usecache` is true
		'extension' => 'htm' // our templates files will have htm extension
	);
```

### Usage

[](#usage)

```
require '../vendor/autoload.php';

$templater = new Gelembjuk\Templating\SmartyTemplating();
// $templater = new Gelembjuk\Templating\TwigTemplating();

// init template engine
$templater->init($templateroptions);

$templater->setVar('firstname',"John");
$templater->setVar('lastname',"Smith");

$templater->setTemplate('homepage');

// fetch page page content
$pagecontent = $templater->fetchTemplate();

echo $pagecontent;
```

File **homepage.htm** in case of Smarty

```

Hello {$lastname}, {$firstname}

```

File **homepage.htm** in case of Twig

```

Hello {{ lastname }}, {{ firstname }}

```

### Author

[](#author)

Roman Gelembjuk (@gelembjuk)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

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

Total

8

Last Release

3670d ago

### Community

Maintainers

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

---

Top Contributors

[![Gelembjuk](https://avatars.githubusercontent.com/u/1552191?v=4)](https://github.com/Gelembjuk "Gelembjuk (16 commits)")

### Embed Badge

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

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

###  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)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

545.8M69](/packages/symfony-ux-icons)

PHPackages © 2026

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