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

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

davidecesarano/embryo-view
==========================

A PHP renderer for rendering PHP views in PSR response.

1.0.3(5y ago)21471MITPHPPHP &gt;=7.1

Since Oct 31Pushed 5y ago3 watchersCompare

[ Source](https://github.com/davidecesarano/Embryo-View)[ Packagist](https://packagist.org/packages/davidecesarano/embryo-view)[ Docs](https://github.com/davidecesarano/embryo-view)[ RSS](/packages/davidecesarano-embryo-view/feed)WikiDiscussions master Synced yesterday

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

Embryo View
===========

[](#embryo-view)

PHP template engine and renderer for PSR-7 response.

Features
--------

[](#features)

- PSR compatible.
- Alternative syntax.
- Views compiled and cached until they are modified.
- PSR-15 middleware for minify html.

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

[](#requirements)

- PHP &gt;= 7.1
- A [PSR-7](https://www.php-fig.org/psr/psr-7/) http message implementation and [PSR-17](https://www.php-fig.org/psr/psr-17/) http factory implementation (ex. [Embryo-Http](https://github.com/davidecesarano/Embryo-Http))
- A PSR response emitter (ex. [Embryo-Emitter](https://github.com/davidecesarano/Embryo-Emitter))

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

[](#installation)

Using Composer:

```
$ composer require davidecesarano/embryo-view

```

Example
-------

[](#example)

Create `Response` object, set `views` and `compilers` directory, create a `View` object. Render view with `render()` method passing response, template and data. Finally, emit response.

```
use Embryo\Http\Emitter\Emitter;
use Embryo\Http\Factory\{ResponseFactory, StreamFactory};
use Embryo\View\View;

$response      = (new ResponseFactory)->createResponse(200);
$templatePath  = __DIR__.DIRECTORY_SEPARATOR.'views';
$compilerPath  = __DIR__.DIRECTORY_SEPARATOR.'compilers';
$view          = new View($templatePath, $compilerPath);

$response = $view->render($response, 'page', ['message' => 'Hello World!', 'status' => 1]);

$emitter = new Emitter;
$emitter->emit($response);
```

Usage
-----

[](#usage)

### Create and render views

[](#create-and-render-views)

If you want create a template with partials file, you can write this:

```

        {{ $title }}

```

```

@include('header', ['title' => $title])

        {{ $title }}

```

In this example you can use `@include(filename, data)` for include header.php in home.php passing data to file. Embryo View will compile the file by replacing the alternative syntax in PHP code. Finally, you may display page with render:

```
$response = $view->render($response, 'home', ['title' => 'Hello World!']);
```

### Display data

[](#display-data)

You may display the contents of the name variable like so:

```
{{ $name }} // echo htmlentites($name)

```

If you want display html content use like so:

```
{{{ $html }}} // echo $html

```

If you use VueJs mustache templating, you may use like so:

```
@{{ myVar }} // echo {{ myVar }}

```

### If statements

[](#if-statements)

You may construct if statements using the `@if`, `@elseif`, `@else`, and `@endif` directives.

```
@if ($status == 1)
    Status is 1
@elseif ($status == 2)
    Status is 2
@else
    Status is {{ $status }}
@endif

```

### Loops

[](#loops)

Embryo View provides simple directives for working with PHP's loop structures (`for`, `foreach` and `while`):

```
@for ($i = 0; $i < 10; $i++)
    Value is {{ $i }}
@endfor

@foreach ($users as $user)
    User id is {{ $user->id }}
@endforeach

@while ($user = $users)
    User id is {{ $user->id }}
@endwhile

```

### PHP

[](#php)

You can use the `@php` directive to execute a block of plain PHP within your template:

```
@php
    $a = 1;
    echo  $a;
@endphp

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

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

Every ~59 days

Total

4

Last Release

1842d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16277144?v=4)[Davide Cesarano](/maintainers/davidecesarano)[@davidecesarano](https://github.com/davidecesarano)

---

Top Contributors

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

---

Tags

psrviewrenderer

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[laminas/laminas-view

Fast and type safe HTML templating library with a flexible plugin system supporting multistep template composition

7526.3M230](/packages/laminas-laminas-view)[shoot/shoot

Shoot aims to make providing data to your templates more manageable

40229.9k2](/packages/shoot-shoot)

PHPackages © 2026

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