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.6k1[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 1mo 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 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity61

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

1207d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5abb5289c0233a035c7a5d1fcd6b741734c640911eff18d86b781ff6e5caea22?d=identicon)[blue-tomato](/maintainers/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

[ytake/laravel-smarty

Smarty template engine for Laravel and Lumen

87401.6k](/packages/ytake-laravel-smarty)[noiselabs/smarty-bundle

This Symfony bundle provides integration for the Smarty3 template engine.

53194.4k1](/packages/noiselabs-smarty-bundle)[wanze/template-engine-factory

Provides ProcessWire integration for various template engines such as Twig.

2612.0k4](/packages/wanze-template-engine-factory)[latrell/smarty

This package lets you run Smarty3 on Laravel5 elegantly.

137.0k](/packages/latrell-smarty)[wanze/template-engine-twig

ProcessWire module adding Twig to the TemplateEngineFactory

128.1k](/packages/wanze-template-engine-twig)

PHPackages © 2026

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