PHPackages                             pollen-solutions/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. [Templating &amp; Views](/categories/templating)
4. /
5. pollen-solutions/view

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

pollen-solutions/view
=====================

Pollen Solutions - View Component - View template engine system.

v1.0.3(4y ago)05696MITPHPPHP ^7.4 || ^8.0

Since Jul 9Pushed 2y ago1 watchersCompare

[ Source](https://github.com/pollen-solutions/view)[ Packagist](https://packagist.org/packages/pollen-solutions/view)[ Docs](https://www.presstify.com/pollen-solutions/view/)[ RSS](/packages/pollen-solutions-view/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (6)Versions (6)Used By (6)

View Component
==============

[](#view-component)

[![Latest Version](https://camo.githubusercontent.com/478c7445e33a15d520d6b82972113f5df02434c584993421df01bd097db0a398/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f72656c656173652d312e302e302d626c75653f7374796c653d666f722d7468652d6261646765)](https://www.presstify.com/pollen-solutions/view/)[![MIT Licensed](https://camo.githubusercontent.com/daa52099573be5a50c320c4387496400f2f722e49f86a42db8d5778130d3582d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e3f7374796c653d666f722d7468652d6261646765)](LICENSE.md)[![PHP Supported Versions](https://camo.githubusercontent.com/d9d71d0b69072c51e1ff7adfdb6270f896f75787500ce6437120e23727c081d1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d2533453d372e342d3838393242463f7374796c653d666f722d7468652d6261646765266c6f676f3d706870)](https://www.php.net/supported-versions.php)

Pollen Solutions **View** Component is a template engine system.

This is an expandable display template engine that natively integrates **Plates** and **Twig** library.

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

[](#installation)

```
composer require pollen-solutions/view
```

Fundamentals
------------

[](#fundamentals)

### About Plates

[](#about-plates)

**Plates** is a native PHP template system that’s fast, easy to use. It’s inspired by the [Twig](#about-twig) template engine. Plates is designed for developers who prefer to use native PHP templates over compiled template languages.

Plates is use as default engine in the Pollen Solutions Components Suite.

More informations :

- [Plates official documentation](https://platesphp.com/)

### About Twig

[](#about-twig)

**Twig** is the templating engine that included with [Symfony Framework](https://symfony.com/). **Twig** is a modern template engine for PHP. **Twig** compiles templates down to plain optimized PHP code.

**Twig** is natively included with Pollen View component.

More informations :

- [Twig official documentation](https://twig.symfony.com/doc/)

### Third-party Engine

[](#third-party-engine)

#### Blade

[](#blade)

**Blade** is the templating engine that included with [Laravel Framework](https://laravel.com/).

**Blade** is not natively included with the Pollen View component, but can easily be added :

```
composer require pollen-solutions/view-blade
```

More informations :

- [Blade official documentation](https://laravel.com/docs/8.x/blade)

#### Mustache

[](#mustache)

Mustache PHP engine is currently in project and coming soon.

More informations :

- [Mustache official documentation](https://github.com/bobthecow/mustache.php/wiki)

Fundamentals
------------

[](#fundamentals-1)

### An unified API interface

[](#an-unified-api-interface)

To respond to the particularity of each of the model display engines, Pollen View benefits from a unified interface this makes it possible to work with different engines via the same API.

### Directory and override

[](#directory-and-override)

Pollen **View** purposes a different logic from the libraries it inherits.

Each template file included in the template directory can be replaced by a template file with the same name in the override directory.

### Extending the template engine

[](#extending-the-template-engine)

Pollen **View** also makes it possible to extend the functionalities of the template display engines through an easy interface.

### Caching

[](#caching)

To facilitate the work of application development, Pollen View allows you to disable the cache of the display template engines that it implements.

It is strongly recommended that you enable the cache when deploying to production.

Using global View
-----------------

[](#using-global-view)

#### Template file

[](#template-file)

```
# /var/www/html/views/hello-world.plates.php
echo 'Hello World !';
```

#### View call

[](#view-call)

```
use Pollen\View\ViewManager;

$viewManager = new ViewManager();

$viewManager->setDirectory('/var/www/html/views');

echo $view->render('hello-world');
exit;
```

Creating a new view instance
----------------------------

[](#creating-a-new-view-instance)

### Simple usage

[](#simple-usage)

#### Template file

[](#template-file-1)

```
# /var/www/html/views/hello-world.plates.php
echo 'Hello World' . $this->get('name') . '!';
```

#### View call

[](#view-call-1)

```
use Pollen\View\ViewManager;

$viewManager = new ViewManager();

## Creating a Plates View
$view = $viewManager->createView('plates')->setDirectory('/var/www/html/views');

echo $view->render('hello-world', ['name' => 'John Doe']);
exit;
```

### Advanced usage

[](#advanced-usage)

In this example we use a customized template class and the view is configured through the view engine callback.

#### Customized template class

[](#customized-template-class)

```
namespace Acme\View;

use Pollen\View\Engines\Plates\PlatesTemplate as BasePlatesTemplate;

class PlatesTemplate extends BasePlatesTemplate
{
    public function helloWorldName(string $name): string
    {
        return 'Hello World '. $name . '!';
    }
}
```

#### Template file

[](#template-file-2)

```
# /var/www/html/views/hello-world.plates.php
/**
 * @var Acme\View\PlatesTemplate $this
 */
echo $this->helloWorldName($this->get('name'));
```

#### View call

[](#view-call-2)

```
use Pollen\View\ViewManager;
use Pollen\View\Engines\Plates\PlatesViewEngine;
use Acme\View\PlatesTemplate;

$viewManager = new ViewManager();

$directory = '/var/www/html/views';

$view = $viewManager->createView(
    (new PlatesViewEngine()),
    function (PlatesViewEngine $platesViewEngine) use ($directory) {
        $platesViewEngine->platesEngine()
            ->setDirectory($directory);

        $platesViewEngine->platesEngine()->setTemplateClass(PlatesTemplate::class);

        return $platesViewEngine;
    }
);

echo $view->render('hello-world', ['name' => 'John Doe']);
exit;
```

Extending a View
----------------

[](#extending-a-view)

### Simple method (with a callback)

[](#simple-method-with-a-callback)

#### Template file

[](#template-file-3)

```
# /var/www/html/views/hello-world.plates.php
echo $this->helloWorldName($this->get('name'));
```

#### View call

[](#view-call-3)

```
use Pollen\View\ViewManager;

$viewManager = new ViewManager();

$view = $viewManager->createView('plates')
    ->setDirectory('/var/www/html/views')
    ->addExtension('helloWorldName', function (string $name): string {
        return sprinf('Hello World %s !', $name);
    });

echo $view->render('hello-world', ['name' => 'John Doe']);
exit;
```

### Advanced method with View Extension class

[](#advanced-method-with-view-extension-class)

#### View Extension class

[](#view-extension-class)

```
use Acme\View;

use Pollen\View\ViewExtension;
use Pollen\View\ViewEngineInterface;
use Pollen\View\Engines\Plates\PlatesViewEngine;
use Pollen\View\Engines\Twig\TwigViewEngine;
use Twig\TwigFunction;

class HelloWorldNameViewExtension extends ViewExtension
{
    public function register(ViewEngineInterface $viewEngine)
    {
        if (is_a($viewEngine, PlatesViewEngine::class)) {
            $viewEngine->platesEngine()->registerFunction(
                    $this->getName(),
                    function (string $name): string {
                        return sprinf('Hello World %s !', $name);
                    }
                );
        }

        /**
         * Extending Twig
         * @see https://twig.symfony.com/doc/3.x/advanced.html
         */
        if (is_a($viewEngine, TwigViewEngine::class)) {
            $viewEngine->twigEnvironment()->addFunction(
                new TwigFunction(
                    $this->getName(),
                    function (string $name): string {
                        return sprinf('Hello World %s !', $name);
                    }
                )
            );
        }

        return null;
    }
}
```

#### Template file

[](#template-file-4)

```
# /var/www/html/views/hello-world.plates.php
echo $this->helloWorldName($this->get('name'));
```

#### View call

[](#view-call-4)

```
use Pollen\View\ViewManager;
use Acme\View\HelloWorldNameViewExtension;

$viewManager = new ViewManager();

$view = $viewManager->createView('plates')
    ->setDirectory('/var/www/html/views')
    ->addExtension('helloWorldName', new HelloWorldNameViewExtension());

echo $view->render('hello-world', ['name' => 'John Doe']);
exit;
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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

5

Last Release

1766d ago

### Community

Maintainers

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

---

Top Contributors

[![jordy-manner](https://avatars.githubusercontent.com/u/733356?v=4)](https://github.com/jordy-manner "jordy-manner (2 commits)")[![JordyMannerSmile](https://avatars.githubusercontent.com/u/98341768?v=4)](https://github.com/JordyMannerSmile "JordyMannerSmile (1 commits)")

---

Tags

viewcomponenttemplate enginepollen-solutions

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pollen-solutions-view/health.svg)

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

###  Alternatives

[wyrihaximus/twig-view

Twig powered View for CakePHP

804.7M1](/packages/wyrihaximus-twig-view)[leitsch/kirby-blade

Enable Laravel Blade Template Engine for Kirby 4 and Kirby 5

219.2k](/packages/leitsch-kirby-blade)

PHPackages © 2026

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