PHPackages                             hitsi/mezzio-smarty-renderer - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. hitsi/mezzio-smarty-renderer

ActiveLibrary[HTTP &amp; Networking](/categories/http)

hitsi/mezzio-smarty-renderer
============================

Smarty integration for Mezzio

1.0.1(4y ago)014BSD-3-ClausePHPPHP ^7.4 || ~8.0.0

Since Sep 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Hitsi/mezzio-smarty-renderer)[ Packagist](https://packagist.org/packages/hitsi/mezzio-smarty-renderer)[ RSS](/packages/hitsi-mezzio-smarty-renderer/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (7)Versions (3)Used By (0)

Smarty Integration for Mezzio
=============================

[](#smarty-integration-for-mezzio)

Provides [Smarty](https://www.smarty.net/) integration for [Mezzio](https://docs.laminas.dev//mezzio/).

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

[](#installation)

Install this library using composer:

```
$ composer require hitsi/mezzio-smarty-renderer
```

Mezzio team recommend using a dependency injection container, and typehint against [container-interop](https://github.com/container-interop/container-interop). We can recommend the following implementations:

- [laminas-servicemanager](https://github.com/laminas/laminas-servicemanager): `composer require laminas/laminas-servicemanager`
- [pimple-interop](https://github.com/moufmouf/pimple-interop): `composer require mouf/pimple-interop`
- [Aura.Di](https://github.com/auraphp/Aura.Di): `composer require aura/di`

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

[](#configuration)

You need to include the `Hitsi\Mezzio\SmartyRenderer\ConfigProvider` in your [`config/config.php`](https://github.com/mezzio/mezzio-skeleton/blob/master/config/config.php). Optional configuration can be stored in `config/autoload/templates.global.php`.

```
'templates' => [
    'extension' => 'file extension used by templates; defaults to tpl',
    'paths' => [
        // namespace / path pairs
    ],
],
'smarty' => [
    'template_dir' => 'default/main templates',
    'cache_dir' => 'path to cached templates',
    'compile_dir' => 'path to compiled templates',
    'config_dir' => 'path to config',
    'assets_url' => 'base URL for assets',
    'assets_version' => 'base version for assets',
    'plugins' => [
        // your own plugins
    ],
    'globals' => [
        // Global variables passed to smarty templates
    ],
    'compile_check' => true, // https://www.smarty.net/docs/en/variable.compile.check.tpl
    'force_compile' => false, // https://www.smarty.net/docs/en/variable.force.compile.tpl
    'caching' => false, // https://www.smarty.net/docs/en/variable.caching.tpl
    'debugging' => false, // https://www.smarty.net/docs/en/variable.debugging.tpl
],
```

Paths
-----

[](#paths)

You can use multiple paths (namespaces) for templates

```
'templates' => [
    'extension' => 'file extension used by templates; defaults to tpl',
    'paths' => [
        'app' => __DIR__.'/../templates/app',
        'admin' => __DIR__.'/../templates/admin',
        'layout' => __DIR__.'/../templates/layout',
        ...
    ],
],
'smarty' => [
    'template_dir' => __DIR__.'/../templates',
    ...
]
```

And render them

```
$this->template->render('app::index', $params);
```

OR

```
$this->template->render('app/index.tpl', $params);
```

In template

```
{extend file='layout:main.tpl'}
```

OR short description

```
{extend 'layout:main.tpl'}
```

Smarty Plugin
-------------

[](#smarty-plugin)

The included Smarty plugin adds support for url generation.

- `path`: Render the relative path for a given route and parameters. If there is no route, it returns the current path.

    ```
    {#path route='article_show' id='3'}
    Generates: /article/3
    ```
- `url`: Render the absolute url for a given route and parameters. If there is no route, it returns the current url.

    ```
    {url route='article_show' id='3'}
    Generates: http://example.com/article/3
    ```
- `absolute_url`: Render the absolute url from a given path. If the path is empty, it returns the current url.

    ```
    {absolute_url route='path/to/something'}
    Generates: http://example.com/path/to/something
    ```
- `asset` Render an (optionally versioned) asset url.

    ```
    {asset route='path/to/asset/name.ext' version='3'}
    Generates: path/to/asset/name.ext?v=3
    ```

    To get the absolute url for an asset:

    ```
    {absolute_url route={asset route='path/to/asset/name.ext' version='3'}}
    Generates: http://example.com/path/to/asset/name.ext?v=3
    ```

Configuration Plugin
--------------------

[](#configuration-plugin)

You need to include the `Hitsi\Mezzio\SmartyRenderer\Plugins\ConfigProvider` in your [`config/config.php`](https://github.com/mezzio/mezzio-skeleton/blob/master/config/config.php). Optional you can add you own plugin like this.

```
'factories' => [
    Path\To\YourPlugin::class => Path\To\YourPluginFactory::class,
],
'smarty' => [
    'plugins' => [
        'myplugin' => Path\To\YourPlugin::class,
    ],
],
```

Then use them

```
{myplugin param1="test" param2="done"}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

2

Last Release

1710d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/21336830?v=4)[Alexey](/maintainers/Hitsi)[@Hitsi](https://github.com/Hitsi)

---

Top Contributors

[![Hitsi](https://avatars.githubusercontent.com/u/21336830?v=4)](https://github.com/Hitsi "Hitsi (5 commits)")

---

Tags

httppsrpsr-7middlewarelaminasmezziosmarty

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hitsi-mezzio-smarty-renderer/health.svg)

```
[![Health](https://phpackages.com/badges/hitsi-mezzio-smarty-renderer/health.svg)](https://phpackages.com/packages/hitsi-mezzio-smarty-renderer)
```

###  Alternatives

[mezzio/mezzio

PSR-15 Middleware Microframework

3883.6M97](/packages/mezzio-mezzio)[mezzio/mezzio-helpers

Helper/Utility classes for Mezzio

134.3M67](/packages/mezzio-mezzio-helpers)[mezzio/mezzio-fastroute

FastRoute integration for Mezzio

162.7M52](/packages/mezzio-mezzio-fastroute)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.0M61](/packages/mezzio-mezzio-router)[mezzio/mezzio-tooling

Migration and development tooling for Mezzio

191.1M21](/packages/mezzio-mezzio-tooling)[mezzio/mezzio-authentication-oauth2

OAuth2 (server) authentication middleware for Mezzio and PSR-7 applications.

28483.0k2](/packages/mezzio-mezzio-authentication-oauth2)

PHPackages © 2026

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