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 2y ago2 watchersCompare

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

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

30

—

LowBetter than 62% of packages

Maintenance20

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

3724d 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

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3851.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.1k](/packages/area17-laravel-auto-head-tags)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.3k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

282.2k](/packages/webkinder-sproutset)

PHPackages © 2026

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