PHPackages                             greg-md/php-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. greg-md/php-view

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

greg-md/php-view
================

A powerful View for PHP.

v1.0.0(9y ago)1202↓100%2[1 PRs](https://github.com/greg-md/php-view/pulls)MITPHPPHP ^5.6 || ^7.0CI passing

Since Jan 20Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/greg-md/php-view)[ Packagist](https://packagist.org/packages/greg-md/php-view)[ Docs](https://github.com/greg-md/php-view)[ RSS](/packages/greg-md-php-view/feed)WikiDiscussions master Synced 2mo ago

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

Greg PHP View
=============

[](#greg-php-view)

[![StyleCI](https://camo.githubusercontent.com/bca6e365ce7d44f60fe252b834ffd994597629c10a6a4448c96545e78fbad8ca/68747470733a2f2f7374796c6563692e696f2f7265706f732f37313030313035342f736869656c643f7374796c653d666c6174)](https://styleci.io/repos/71001054)[![Build Status](https://camo.githubusercontent.com/0811f58d7b2f87d9da9aebac52522ee699f47ac4d324f8a91ef2adcea7e1d304/68747470733a2f2f7472617669732d63692e6f72672f677265672d6d642f7068702d766965772e737667)](https://travis-ci.org/greg-md/php-view)[![Total Downloads](https://camo.githubusercontent.com/adb8ad3abcc2b78de182e38842122e58c8ce50344f18d12c5655ab17cc9441a7/68747470733a2f2f706f7365722e707567782e6f72672f677265672d6d642f7068702d766965772f642f746f74616c2e737667)](https://packagist.org/packages/greg-md/php-view)[![Latest Stable Version](https://camo.githubusercontent.com/15bcf9e72d2b0701adb75ad96696da535ec2335319b225aa706b5ce46878e749/68747470733a2f2f706f7365722e707567782e6f72672f677265672d6d642f7068702d766965772f762f737461626c652e737667)](https://packagist.org/packages/greg-md/php-view)[![Latest Unstable Version](https://camo.githubusercontent.com/6ced3525c4074dfba8a9361ddf3418f9c3b8c55157d6ba67ff7d18d318c55e3b/68747470733a2f2f706f7365722e707567782e6f72672f677265672d6d642f7068702d766965772f762f756e737461626c652e737667)](https://packagist.org/packages/greg-md/php-view)[![License](https://camo.githubusercontent.com/2b174419cfc982bde2f22ab9aa44738f07c53062297fc969ec6e9ac74d36e1d9/68747470733a2f2f706f7365722e707567782e6f72672f677265672d6d642f7068702d766965772f6c6963656e73652e737667)](https://packagist.org/packages/greg-md/php-view)

A powerful View for PHP.

Table of Contents:
==================

[](#table-of-contents)

- [Requirements](#requirements)
- [Compilers](#compilers)
- [How It Works](#how-it-works)
- [Documentation](#documentation)
- [License](#license)
- [Huuuge Quote](#huuuge-quote)

Requirements
============

[](#requirements)

- PHP Version `^7.1`

Compilers
=========

[](#compilers)

- PHP
- Blade

How It Works
============

[](#how-it-works)

**First of all**, you have to initialize a [Viewer](docs/Viewer.md):

```
$viewsDirectory = __DIR__ . '/views';

$viewer = new \Greg\View\Viewer($viewsDirectory);
```

**Optionally**, you can add a view compiler. For example a [Blade Compiler](docs/ViewBladeCompiler.md) specially created for the [Viewer](docs/Viewer.md):

```
// Turn it to a callable, to load only when using blade templates.
$viewer->addExtension('.blade.php', function () {
    $compiledViewsDirectory = __DIR__ . '/compiled';

    return new \Greg\View\ViewBladeCompiler($compiledViewsDirectory);
});
```

*By default it will use [Renderer](docs/Renderer.md) as an instance of a template.*

*Note:* If you want to use your own compiler, it has to be an instance of [Compiler Strategy](docs/CompilerStrategy.md).

**Now**, you can render views where you want in your application.

Create a template file in the views directory. For example `welcome.blade.php`:

```

        Hello, {{ $name }}

```

Use `welcome` template in your application:

```
$content = $viewer->render('welcome', [
    'name' => 'Greg',
]);

echo $content;
```

Documentation
=============

[](#documentation)

- [Viewer](docs/Viewer.md) - The view manager;
- [Renderer](docs/Renderer.md) - Instance of a template. Could be accessed via `$this` variable in the template.
- [Loader](docs/Loader.md) - A special loader for [Renderer](docs/Renderer.md) which will give access only to its public properties and methods;
- [Blade Compiler](docs/BladeCompiler.md) - An independent template compiler;
- [View Blade Compiler](docs/ViewBladeCompiler.md) - An extended [Blade Compiler](docs/BladeCompiler.md), specially for the [Viewer](Viewer.md).
- [Compiler Strategy](docs/CompilerStrategy.md) - A strategy for custom compilers;
- [View Compiler Strategy](docs/ViewCompilerStrategy.md) - A strategy for custom [Viewer](docs/Viewer.md) compilers;

License
=======

[](#license)

MIT © [Grigorii Duca](http://greg.md)

Huuuge Quote
============

[](#huuuge-quote)

[![I fear not the man who has practiced 10,000 programming languages once, but I fear the man who has practiced one programming language 10,000 times. #horrorsquad](https://camo.githubusercontent.com/73fc580403a8367b075fff0a0d7439dc0dc095dd3124b22757522675c1308df8/687474703a2f2f677265672e6d642f6875757567652d71756f74652d66622e6a7067)](https://camo.githubusercontent.com/73fc580403a8367b075fff0a0d7439dc0dc095dd3124b22757522675c1308df8/687474703a2f2f677265672e6d642f6875757567652d71756f74652d66622e6a7067)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance54

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

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

3401d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/85a6700372326d0546fcff3eb2c3f27daa711273bdd5d6fdda875a7d2f02af85?d=identicon)[greg-md](/maintainers/greg-md)

---

Top Contributors

[![greg-md](https://avatars.githubusercontent.com/u/10551984?v=4)](https://github.com/greg-md "greg-md (3 commits)")

---

Tags

bladegreg-mdgreg-phpphpphp-viewviewviewerweb-artisansphp-viewgreg

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/greg-md-php-view/health.svg)

```
[![Health](https://phpackages.com/badges/greg-md-php-view/health.svg)](https://phpackages.com/packages/greg-md-php-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)
