PHPackages                             gkralik/gk-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. gkralik/gk-smarty

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

gkralik/gk-smarty
=================

Zend Framework 2 Module that provides a Smarty rendering strategy

1.1.0(10y ago)36.6k6[1 issues](https://github.com/gkralik/gk-smarty/issues)MITPHPPHP &gt;=5.3.3

Since Mar 7Pushed 7y ago1 watchersCompare

[ Source](https://github.com/gkralik/gk-smarty)[ Packagist](https://packagist.org/packages/gkralik/gk-smarty)[ Docs](http://www.github.com/gkralik/GkSmarty/)[ RSS](/packages/gkralik-gk-smarty/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (3)Versions (8)Used By (0)

GkSmarty - Smarty Module for Zend Framework 2
=============================================

[](#gksmarty---smarty-module-for-zend-framework-2)

GkSmarty is a module for integrating the [Smarty](http://www.smarty.net) template engine with [Zend Framework 2](http://framework.zend.com).

Installation with Composer
--------------------------

[](#installation-with-composer)

Installing via [Composer](http://getcomposer.org) is the only supported method.

1. Add `"gkralik/gk-smarty": "~1.0"` to your `composer.json` file and run `php composer.phar update`.
2. Add `GkSmarty` to your application's `config/application.config.php` file under the `modules` key.

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

[](#configuration)

For information on configuring GkSmarty, refer to the [module config file](https://github.com/gkralik/gk-smarty/tree/master/config/module.config.php).

There is also a [sample configuration file](https://github.com/gkralik/gk-smarty/tree/master/config/gk-smarty.config.php.dist) with all available configuration options.

You can set options for the Smarty engine under the `smarty_options` configuration key (eg `force_compile`, etc).

Pay attention to the `compile_dir` and `cache_dir` keys. Smarty needs write access to the directories specified there.

Documentation
-------------

[](#documentation)

### Using ZF2 View Helpers

[](#using-zf2-view-helpers)

Using view helpers of ZF2 is supported. Just call the view helper as you would do in a PHTML template:

```
{$this->docType()}

{$this->basePath('some/path')}
```

### View helpers that need access to the renderer

[](#view-helpers-that-need-access-to-the-renderer)

ZF2 has some issues with supporting multiple renderers with view helpers. GkSmarty uses it's own `HelperPluginManager` to work around this issue. The default plugin manager from ZF2 is added as a peering manager to ease using view helpers that do not required access to the renderer. This means

You must register view helpers that require a renderer with GkSmarty's helper manager. Refer to `module.config.php` for an example. Some defaults have been taken care of for you (see [HelperPluginManager](https://github.com/gkralik/gk-smarty/tree/master/src/GkSmarty/View/HelperPluginManager.php) for details).

Acknowledgements
----------------

[](#acknowledgements)

Thanks to [ZfcTwig](https://github.com/ZF-Commons/ZfcTwig) for an excellent example on how to integrate templating engines with ZF2 and for finding a workaround for view helpers that need access to the renderer (see above).

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 95.5% 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 ~154 days

Recently: every ~192 days

Total

6

Last Release

3732d ago

Major Versions

0.5.3 → 1.0.02015-10-10

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4949303?v=4)[Gregor Kralik](/maintainers/gkralik)[@gkralik](https://github.com/gkralik)

---

Top Contributors

[![gkralik](https://avatars.githubusercontent.com/u/4949303?v=4)](https://github.com/gkralik "gkralik (42 commits)")[![thestanislav](https://avatars.githubusercontent.com/u/1858311?v=4)](https://github.com/thestanislav "thestanislav (2 commits)")

---

Tags

modulezf2smarty

### Embed Badge

![Health badge](/badges/gkralik-gk-smarty/health.svg)

```
[![Health](https://phpackages.com/badges/gkralik-gk-smarty/health.svg)](https://phpackages.com/packages/gkralik-gk-smarty)
```

###  Alternatives

[zf-commons/zfc-twig

Zend Framework 2 Module that provides a Twig rendering strategy and extensions to render actions or trigger events from your templates

93579.6k7](/packages/zf-commons-zfc-twig)

PHPackages © 2026

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