PHPackages                             blue-tomato/template-engine-smarty - 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. blue-tomato/template-engine-smarty

ActiveProcesswire-module[Templating &amp; Views](/categories/templating)

blue-tomato/template-engine-smarty
==================================

ProcessWire module adding Smarty to the TemplateEngineFactory

2.6.0(3y ago)62.8k[1 PRs](https://github.com/blue-tomato/TemplateEngineSmarty/pulls)MITPHPPHP &gt;=7.0

Since Feb 27Pushed 3y ago2 watchersCompare

[ Source](https://github.com/blue-tomato/TemplateEngineSmarty)[ Packagist](https://packagist.org/packages/blue-tomato/template-engine-smarty)[ Docs](https://github.com/blue-tomato/TemplateEngineSmarty)[ RSS](/packages/blue-tomato-template-engine-smarty/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (2)Versions (12)Used By (0)

TemplateEngineSmarty
====================

[](#templateenginesmarty)

[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)[![ProcessWire 3](https://camo.githubusercontent.com/34449e2237c61f5c40a0cbf06273d9f22ee4b9ba45442c77b6554c874927b1ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50726f63657373576972652d332e782d6f72616e67652e737667)](https://github.com/processwire/processwire)

A ProcessWire module adding Smarty to the [TemplateEngineFactory](https://github.com/wanze/TemplateEngineFactory).

Requirements
------------

[](#requirements)

- ProcessWire `3.0` or newer
- TemplateEngineFactory `2.0` or newer
- PHP `7.0` or newer
- Composer

> The `1.x` version of this module is available on the [1.x branch](https://github.com/blue-tomato/TemplateEngineSmarty/tree/1.x). Use this version if you still use *TemplateEngineFactory* `1.x`.

Installation
------------

[](#installation)

Execute the following command in the root directory of your ProcessWire installation:

```
composer require blue-tomato/template-engine-smarty:^2.0

```

This will install the *TemplateEngineSmarty* and *TemplateEngineFactory* modules in one step. Afterwards, don't forget to enable Smarty as engine in the *TemplateEngineFactory* module's configuration.

> ℹ️ This module includes test dependencies. If you are installing on production with `composer install`, make sure to pass the `--no-dev` flag to omit autoloading any unnecessary test dependencies!.

Configuration
-------------

[](#configuration)

The module offers the following configuration:

- **`Template files suffix`** The suffix of the Smarty template files, defaults to `tpl`.
- **`Provide ProcessWire API variables in Smarty templates`** API variables (`$pages`, `$input`, `$config`...) are accessible in Smarty, e.g. `{{ config }}` for the config API variable.
- **`Debug`** If enabled, Smarty outputs debug information.
- **`Compile Check`** If enabled, templates are recompiled whenever the source code changes.
- **`Error Reporting`** If set to `false`, Smarty will silently ignore invalid variables (variables and or attributes/methods that do not exist) and replace them with a `null` value. When set to `true`, Smarty throws an exception instead
- **`Escape HTML`** If enabled, templates will auto-escape variables. If you are using ProcessWire textformatters to escape field values, do not enable this feature.

Extending Smarty
----------------

[](#extending-smarty)

It is possible to extend Smarty after it has been initialized by the module. Hook the method `TemplateEngineSmarty::initSmarty`to register custom functions, extensions, global variables, filters etc.

Here is an example how you can use the provided hook to attach a custom function.

```
function foo_function($params, $smarty) {
  return 'bar';
};

wire()->addHookAfter('TemplateEngineSmarty::initSmarty', function (HookEvent $event) {
    /** @var \Smarty $smarty */
    $smarty = $event->arguments('smarty');

    $smarty->registerPlugin("function", "foo", "foo_function");
});

// ... and then use it anywhere in a Smarty template:

{foo}
```

> The above hook can be put in your `site/init.php` file. If you prefer to use modules, put it into the module's `init()`method and make sure that the module is auto loaded.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

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

Recently: every ~142 days

Total

10

Last Release

1264d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/41725719?v=4)[Blue Tomato](/maintainers/blue-tomato)[@blue-tomato](https://github.com/blue-tomato)

---

Top Contributors

[![tiefenb](https://avatars.githubusercontent.com/u/488163?v=4)](https://github.com/tiefenb "tiefenb (15 commits)")[![wanze](https://avatars.githubusercontent.com/u/2118742?v=4)](https://github.com/wanze "wanze (12 commits)")[![jmartsch](https://avatars.githubusercontent.com/u/551551?v=4)](https://github.com/jmartsch "jmartsch (1 commits)")

---

Tags

processwiresmartysmarty-engine

### Embed Badge

![Health badge](/badges/blue-tomato-template-engine-smarty/health.svg)

```
[![Health](https://phpackages.com/badges/blue-tomato-template-engine-smarty/health.svg)](https://phpackages.com/packages/blue-tomato-template-engine-smarty)
```

###  Alternatives

[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k17.8k](/packages/prestashop-prestashop)[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.5k10](/packages/helsingborg-stad-municipio)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[ytake/laravel-smarty

Smarty template engine for Laravel and Lumen

87408.6k](/packages/ytake-laravel-smarty)[pressbooks/pressbooks-book

This theme is named after Canadian media theorist Marshall McLuhan, who coined the phrase “the medium is the message.” It is designed for academic writing and is also suitable for fiction. Headings are set in Cormorant Garamond, and body type is set in Lora.

206.7k](/packages/pressbooks-pressbooks-book)[noiselabs/smarty-bundle

This Symfony bundle provides integration for the Smarty3 template engine.

53196.2k1](/packages/noiselabs-smarty-bundle)

PHPackages © 2026

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