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

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

phower/view
===========

Standalone templating system for PHP scripts.

1.0.0(9y ago)014MITPHPPHP ^5.6 || ^7.0

Since Apr 9Pushed 9y ago1 watchersCompare

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

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

Phower View
===========

[](#phower-view)

Standalone templating system for PHP scripts.

Requirements
------------

[](#requirements)

Phower View requires:

- [PHP 5.6](http://php.net/releases/5_6_0.php) or above; version [7.0](http://php.net/releases/7_0_0.php) is recommended

Instalation
-----------

[](#instalation)

Add Phower View to any PHP project using [Composer](https://getcomposer.org/):

```
composer require phower/view
```

Usage
=====

[](#usage)

This package provides the essential tools for an application to output any kind of output response supported by an optional list of variables which are rendered inside templates.

Templates are plain PHP scripts which are rendered on a protected environment with all variables already available:

```
Hello !
```

Assuming the template above is a file called `my_template.php` then we can use it to output a new set of variables:

```
use Phower\View\TemplateView;

$view = new TemplateView();
$view->setTemplate('my_template.php');
$view->setVariables(['name'] => 'Pedro');

$view->render(); // outputs: Hello Pedro!
```

### Templates inside templates

[](#templates-inside-templates)

Many times we find useful to implement more than one layer of templating with high level ones outputing other templates.

This can be achived by *capturing* the child template into a variable of the parent template:

```
use Phower\View\TemplateView;

$child = new TemplateView();
$child->setTemplate('child_template.php');

$parent = new TemplateView();
$parent->setTemplate('parent_template.php');
$parent->capture('child', $child);

$parent->render();
```

### JSON views

[](#json-views)

Other times we may wish to output a set of variables not using a template but just as a JSON plain representation:

```
use Phower\View\JsonView;

$view = new JsonView();
$view->setVariables(['name'] => 'Pedro');

$view->render(); // outputs: {"name":"Pedro"}
```

> Note that `JsonTemplate` is fully compatible with [PHP `json_encode`](http://php.net/manual/en/function.json-encode.php)so that we can also set `options` and `depth` and use all the accepted values there on each instance of `JsonTemplate`.

Running Tests
-------------

[](#running-tests)

Tests are available in a separated namespace and can run with [PHPUnit](http://phpunit.de/)in the command line:

```
vendor/bin/phpunit
```

Coding Standards
----------------

[](#coding-standards)

Phower code is written under [PSR-2](http://www.php-fig.org/psr/psr-2/) coding style standard. To enforce that [CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) tools are also provided and can run as:

```
vendor/bin/phpcs
```

Reporting Issues
----------------

[](#reporting-issues)

In case you find issues with this code please open a ticket in Github Issues at .

Contributors
------------

[](#contributors)

Open Source is made of contribuition. If you want to contribute to Phower please follow these steps:

1. Fork latest version into your own repository.
2. Write your changes or additions and commit them.
3. Follow PSR-2 coding style standard.
4. Make sure you have unit tests with full coverage to your changes.
5. Go to Github Pull Requests at and create a new request.

Thank you!

Changes and Versioning
----------------------

[](#changes-and-versioning)

All relevant changes on this code are logged in a separated [log](CHANGELOG.md) file.

Version numbers follow recommendations from [Semantic Versioning](http://semver.org/).

License
-------

[](#license)

Phower code is maintained under [The MIT License](https://opensource.org/licenses/MIT).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

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

3318d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/04e91a806958f09ca8b3f4c24c6f5c4bcbce3c4e44dd882fa1e4c737ee7774c6?d=identicon)[pedrobrazao](/maintainers/pedrobrazao)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  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)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

545.8M69](/packages/symfony-ux-icons)

PHPackages © 2026

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