PHPackages                             ryanknu/zendsmarty - 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. ryanknu/zendsmarty

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

ryanknu/zendsmarty
==================

0.3(9y ago)71983PHP

Since Jan 13Pushed 9y ago1 watchersCompare

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

READMEChangelog (4)DependenciesVersions (5)Used By (0)

Zend Smarty
===========

[](#zend-smarty)

A Smarty Module for Zend Framework 2. **As of 0.3, it is now compatible with Zend Expressive as well, but your package must will require `zendframework/zend-expressive-zendviewrenderer`, or that you select `Zend View Manager` as your renderer during the Zend Expressive quick set up.**.

This package is designed to *properly* implement Smarty into the Zend Framework, unlike other approaches this one mimics the way ZF 2 works. It creates View Model, Strategy, and Renderers and provides factories to them.

Limitation
----------

[](#limitation)

You need to change all of your template names in your module.config.php to point at .tpl files. The .tpl extension will trigger the Smarty view rendering strategy and everything will work as you want. Access to `$this` inside the smarty file is doable via `{$renderer}`. For example, ``.

Regular Smarty limitations apply, which makes it not always easy to change a phtml file to a tpl file. You can pass functions in and call them via `{call_user_func...}`, and you can pass in arrays but they must use square bracket syntax `{if in_array(4, [1,2,3,4])}`.

Instructions
------------

[](#instructions)

1. Get this package. You can get this package through composer now. Running `composer require ryanknu/zendsmarty` will download this package.
2. Get Smarty. I do not bundle it as a dependency because I want to be compatible with any Smarty you want. Typing `composer require smarty/smarty` will get you the latest version.
3. Set your strategies in your project configuration to point to ZSmarty. This will vary a little from project to project, but this is the best gist I can give oyu. This is as easy as setting the following line in a Zend Expressive configuration. (ZF 2.0 and older follow instructions below):

```
    Zend\Expressive\Template\TemplateRendererInterface::class =>
        ZSmarty\Factory\StrategyFactory::class,

```

Instructions (OLD STYLE)
------------------------

[](#instructions-old-style)

1. Download the source of this, copy ZSmarty to Project/vendor/ZSmarty
2. Add 'ZSmarty' to the module list in config/application.config.php
3. Add "'Smarty' =&gt; 'ZSmarty\\StrategyFactory'," to your module.config.php file's 'factories' section (make it so it can find the factory)
4. Add "'strategies' =&gt; array('Smarty')" to your module.config.php file's 'view\_manager' section
5. Add 'use ZSmarty\\SmartyModel;' to your controller's source file's use statements
6. Use the SmartyModel the same way you would use a ViewModel object

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

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

Total

4

Last Release

3403d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8352bd02a16d95e1941fb7ccbd56d8f84eaafc35d1c4d52a5749d47e74be018a?d=identicon)[ryanknu](/maintainers/ryanknu)

---

Top Contributors

[![ryanknu](https://avatars.githubusercontent.com/u/1071147?v=4)](https://github.com/ryanknu "ryanknu (11 commits)")

### Embed Badge

![Health badge](/badges/ryanknu-zendsmarty/health.svg)

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

###  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)
