PHPackages                             adbario/slim-twig-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. adbario/slim-twig-view

ActiveLibrary[Framework](/categories/framework)

adbario/slim-twig-view
======================

Extension for Slim Framework 3 view helper built on top of the Twig 2 templating component

1.0.0(8y ago)098MITPHPPHP &gt;=5.5

Since Jul 20Pushed 8y ago1 watchersCompare

[ Source](https://github.com/adbario/slim-twig-view)[ Packagist](https://packagist.org/packages/adbario/slim-twig-view)[ Docs](https://github.com/adbario/slim-twig-view)[ RSS](/packages/adbario-slim-twig-view/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Slim Framework Twig View add-on
===============================

[](#slim-framework-twig-view-add-on)

This is an extension for [Slim Framework Twig View](https://github.com/slimphp/Twig-View) with the following extra functions:

- adds file extension to template names automatically
- uses dot notation for template file paths

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

[](#installation)

```
composer require adbario/slim-twig-view

```

Usage
-----

[](#usage)

Default extension for the template files is 'twig', this can be changed with the optional setting while registering Twig view on Slim container.

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

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

// Register Twig View helper
$container['view'] = function ($c) {
    $view = new \Adbar\Slim\Views\Twig('path/to/templates', [
        'cache' => 'path/to/cache',
        // Optional template file extension, defaults to 'twig'
        'file_extension' => 'html'
    ]);

    // Instantiate and add Slim specific extension
    $basePath = rtrim(str_ireplace('index.php', '', $c['request']->getUri()->getBasePath()), '/');
    $view->addExtension(new Slim\Views\TwigExtension($c['router'], $basePath));

    return $view;
};

// Define named route
$app->get('/hello/{name}', function ($request, $response, $args) {
    // Render template file from path 'path/to/templates/user/profile.html'
    return $this->view->render($response, 'user.profile', [
        'name' => $args['name']
    ]);
})->setName('profile');

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

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

[](#custom-template-functions)

Read more from [Slim Framework Twig View](https://github.com/slimphp/Twig-View/blob/master/README.md#custom-template-functions)

License
-------

[](#license)

[MIT license](LICENSE.md)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3220d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ae946e82c55043e12c88e2068f384aa467d4ec5f32be112abaf424fcfe046fd?d=identicon)[adbario](/maintainers/adbario)

---

Top Contributors

[![adbario](https://avatars.githubusercontent.com/u/22136575?v=4)](https://github.com/adbario "adbario (1 commits)")

---

Tags

frameworktwigslimtemplateview

### Embed Badge

![Health badge](/badges/adbario-slim-twig-view/health.svg)

```
[![Health](https://phpackages.com/badges/adbario-slim-twig-view/health.svg)](https://phpackages.com/packages/adbario-slim-twig-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)[projek-xyz/slim-plates

Render your Slim 3 application views using Plates template engine.

2678.2k3](/packages/projek-xyz-slim-plates)[rubellum/slim-blade-view

Slim Framework 3 view helper built on the Blade component

1822.4k2](/packages/rubellum-slim-blade-view)

PHPackages © 2026

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