PHPackages                             maps82/smarty-view - 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. [Framework](/categories/framework)
4. /
5. maps82/smarty-view

ActiveLibrary[Framework](/categories/framework)

maps82/smarty-view
==================

Slim Framework view helper built on top of the Smarty template engine

0.4(10y ago)0134MITPHPPHP &gt;=5.5.0

Since Sep 1Pushed 10y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (3)Used By (0)

Slim Framework Smarty View
==========================

[](#slim-framework-smarty-view)

This is a Slim Framework view helper built on top of the Smarty templating component. You can use this component to create and render templates in your Slim Framework application.

Install
-------

[](#install)

Via [Composer](https://getcomposer.org/)

```
$ composer require maps82/smarty-view
```

Requires Slim Framework 3.

Usage
-----

[](#usage)

```
// Create Slim app
$app = new \Slim\App();

// Fetch DI Container
$container = $app->getContainer();

// Register Smarty View helper
$container['view'] = function ($c) {
    $view = new \Slim\Views\Smarty('path/to/templates', [
        'compile' => 'path/to/compile',
        'config' => 'path/to/config', // optional
        'cache' => 'path/to/cache', // optional - omit this to disable caching
        'debug' => false
    ]);

    // Instantiate and add Slim specific extension
    $view->addExtension(new Slim\Views\SmartyExtension(
        $c['router'],
        $c['request']->getUri()
    ));

    return $view;
};

// Define named route
$app->get('/hello/{name}', function ($request, $response, $args) {
    return $this->view->render($response, 'profile.tpl', [
        'name' => $args['name']
    ]);
})->setName('profile');

// Run app
$app->run();
```

Custom template functions
-------------------------

[](#custom-template-functions)

This component exposes a custom `path_for` function to your Smarty templates. You can use this function to generate complete URLs to any Slim application named route. This is an example Smarty template:

```
{extends "layout.tpl"}

{block name="body"}
User List

    Josh

{/block}

```

Credits
-------

[](#credits)

This component is strongly based on the offical slim/twig-view

- [Josh Lockhart](https://github.com/codeguy)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Total

2

Last Release

3866d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e3d34ef7124044ef13e7fc8078686c9149c521787ee33d33146eefe7a070e5a5?d=identicon)[maps82](/maintainers/maps82)

---

Top Contributors

[![maps82](https://avatars.githubusercontent.com/u/12223156?v=4)](https://github.com/maps82 "maps82 (8 commits)")

---

Tags

frameworkslimtemplateviewsmarty

### Embed Badge

![Health badge](/badges/maps82-smarty-view/health.svg)

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

###  Alternatives

[slim/twig-view

Slim Framework 4 view helper built on top of the Twig 3 templating component

3708.0M210](/packages/slim-twig-view)[slim/php-view

Render PHP view scripts into a PSR-7 Response object.

2739.7M95](/packages/slim-php-view)[mathmarques/smarty-view

Slim Framework 4 view helper built on top of the Smarty templating component

24134.7k1](/packages/mathmarques-smarty-view)[rubellum/slim-blade-view

Slim Framework 3 view helper built on the Blade component

1822.4k2](/packages/rubellum-slim-blade-view)[projek-xyz/slim-plates

Render your Slim 3 application views using Plates template engine.

2678.2k3](/packages/projek-xyz-slim-plates)

PHPackages © 2026

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