PHPackages                             ins0/zf2-snippster - 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. ins0/zf2-snippster

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

ins0/zf2-snippster
==================

ZF2 Snipped Module to generate heavy views as snippets and lower the application response time

110[1 issues](https://github.com/ins0/zf2-snippster/issues)PHP

Since Oct 15Pushed 11y ago2 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

zf2-snippster
=============

[](#zf2-snippster)

ZF2 Module to save heavy views as prerendered snippets in cache and lower the application response time on request

todo
----

[](#todo)

- tests
- view helper
- controller helper

Quick start
-----------

[](#quick-start)

### Install via Composer

[](#install-via-composer)

In the `require` key of `composer.json` file add the following

```
"ins0/zf2-snippster": "dev-master"

```

Run the Composer update command

```
$ composer update

```

### cache adapter

[](#cache-adapter)

edit the module.config.php to set your pref. cache adapter snippster works great with redis or memcache

```
'snippster_configuration' => array(
    'cache' => array(
        'adapter' => 'Zend\Cache\Storage\Adapter\Redis',
        'options' => array(
            'server' => array(
                'host' => '127.0.0.1',
                'port' => 6379,
            )
        )
    ),
),

```

example
-------

[](#example)

create a zf2 console route and point a crontab to the route to pre generate all views that are used in your application

### Generate Snippets

[](#generate-snippets)

*config.module.php*

```
'view_manager' => array(
  'template_map' => array(
      'snippster-product-list-item' => __DIR__ . '/../view/snippster/example/product/list-item.phtml',
  )
)

```

*ConsoleExampleController.php*

```
function snippsterCreateExampleProductViews()
{
    /** @var \Snippster\Service\Snippster $snippster */
    $snippster = $this->getServiceLocator()->get('Snippster');

    $products = array(
        array('id' => 1, 'name' => 'Test Product1'),
        array('id' => 2, 'name' => 'Test Product2'),
        array('id' => 3, 'name' => 'Test Product3'),
        array('id' => 4, 'name' => 'Test Product4'),
        array('id' => 5, 'name' => 'Test Product5'),
        array('id' => 6, 'name' => 'Test Product6'),
    );

    foreach($products as $product)
    {
        $viewSnippet = new \Snippster\Entity\ViewSnippet('product-list-item', $product['id']);
        $viewSnippet->setTemplate('snippster-product-list-item');
        $viewSnippet->setVariables($product);

        $snippster->saveViewSnippet($viewSnippet);
    }
}

```

*snippster/example/product/list-item.phtml*

```

    More heavy stuff to build this view

```

### Request Snippets

[](#request-snippets)

controller request view snippet example

```
function productListAction()
{
    /** @var \Snippster\Service\Snippster $snippster */
    $snippster = $this->getServiceLocator()->get('Snippster');

    $html = $snippster->getViewSnippet('product-list-item', 4);
    // get pre rendered product html - do stuff
}

```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/ins0-zf2-snippster/health.svg)

```
[![Health](https://phpackages.com/badges/ins0-zf2-snippster/health.svg)](https://phpackages.com/packages/ins0-zf2-snippster)
```

###  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)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)

PHPackages © 2026

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