PHPackages                             bnf/pug-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. bnf/pug-view

ActiveLibrary[Framework](/categories/framework)

bnf/pug-view
============

Render PUG templates into a PSR-7 Response object.

2.0.0(8y ago)053MITPHP

Since Apr 22Pushed 8y ago1 watchersCompare

[ Source](https://github.com/bnf/pug-view)[ Packagist](https://packagist.org/packages/bnf/pug-view)[ RSS](/packages/bnf-pug-view/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (4)Versions (5)Used By (0)

[![Build Status](https://camo.githubusercontent.com/aae05cd5ba42240ee355972c1c5c44c2ca97dc9f92756c6a433a9b429bd1f657/68747470733a2f2f7472617669732d63692e6f72672f626e662f7075672d766965772e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/bnf/pug-view)

PUG Renderer
------------

[](#pug-renderer)

This is a renderer for rendering PUG templates into a PSR-7 Response object. It works well with Slim Framework 3.

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

[](#installation)

Install with [Composer](http://getcomposer.org):

```
composer require bnf/pug-view

```

Usage with Slim 3
-----------------

[](#usage-with-slim-3)

```
use Bnf\PugView\PugRenderer;

include 'vendor/autoload.php';

$app = new Slim\App();
$container = $app->getContainer();

$settings = [
    'extension' => '.pug',
    'basedir' => 'templates/'
];

$container['view'] = function($c) {
	return new PugRenderer($settings);
};

/* PugRenderer is added as middleware to automatically inject the $response object. */
$app->add('view');

/* Add global template variables */
$app->add(function($request, $response, $next) {
    $this->view->set('title', 'default title');
    // Make the container accessible in the view, so that every object can be accessed in the template:
    // E.g: a(href=c.router.pathFor('named-route'))
    $this->view->set('c', $this);

    return $next($request, $response);
});

$app->get('/hello/{name}', function ($request, $response, $args) {
    return $this->view->render('hello', $args);
});

$app->run();
```

Usage with any PSR-7 Project
----------------------------

[](#usage-with-any-psr-7-project)

```
//Construct the View
$settings = [
    'extension' => '.pug',
    'basedir' => 'templates/'
];
$phpView = new PugRenderer($settings);

//Render a Template
$response = $phpView->render('template', $yourData, new Response());
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

Established project with proven stability

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

Total

4

Last Release

3095d ago

Major Versions

1.1.0 → v3.x-dev2018-01-08

### Community

Maintainers

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

---

Top Contributors

[![bnf](https://avatars.githubusercontent.com/u/473155?v=4)](https://github.com/bnf "bnf (12 commits)")

---

Tags

frameworkslimtemplateviewrendererpug

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bnf-pug-view/health.svg)

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

###  Alternatives

[slim/php-view

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

2749.8M101](/packages/slim-php-view)[slim/twig-view

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

3738.4M230](/packages/slim-twig-view)[rubellum/slim-blade-view

Slim Framework 3 view helper built on the Blade component

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

Slim Framework 3 view helper built on the Blade component

182.0k1](/packages/hiropeke-slim-blade-view)[mathmarques/smarty-view

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

24135.6k1](/packages/mathmarques-smarty-view)

PHPackages © 2026

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