PHPackages                             vengi/engine - 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. vengi/engine

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

vengi/engine
============

A simple Template Engine for PHP.

v0.1.0(3y ago)02MITPHP

Since Oct 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/mauutrera/vengi-templates-engine)[ Packagist](https://packagist.org/packages/vengi/engine)[ RSS](/packages/vengi-engine/feed)WikiDiscussions main Synced 1mo ago

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

About Vengi/Engine
==================

[](#about-vengiengine)

Vengi/Engine is a simple Template Engine for PHP. With vengi you can create your layouts and views in a simple and practical way, vengi is designed for small projects that are looking for something light, and easy to use and understand.

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

[](#installation)

You can add this Library via composer.

```
composer require vengi/engine

```

Usage
-----

[](#usage)

Include the autoload.php:

```
require_once('vendor/autoload.php');

```

Add Vengi:

```
use Vengi\Engine;
use Vengi\View;

```

Config work folders:

```
Engine::views(__DIR__.'/views'); // Set views path.
Engine::layouts(__DIR__.'/views/layouts'); // Set layouts path.

```

Note: By default, if you don't define the layouts path, the views/layouts path will be taken.

### Set and Get Views

[](#set-and-get-views)

Define the view to use.

```
View::set('home');

```

Get the view at index.

```
View::get();

```

### Layout – Sets the content area.

[](#layout--sets-the-content-area)

On the layout, add the following to define the main content area.

```
@{_Content_}@

```

### Layouts and Views.

[](#layouts-and-views)

To write php code without using the opening and closing tags in views and layouts, use {{ }} instead.

```
{{ //php code }} // This is equivalent to, .

```

To do an echo.

```
{= 'Hello World' }} // This is equivalent to, .

```

### In the Views.

[](#in-the-views)

Once you have created the layouts or components to use (Note: components must not have @{*Content*}@, because it is not a layout), to add the layouts or components to the view, do the following:

Add the header of a selected layout.

```
{{ Layout::set('main.layout')->header() }}

```

Add the footer of a selected layout.

```
{{ Layout::set('main.layout')->footer() }}

```

Add the layout as a component.

```
{{ Layout::set('menu')->item() }}

```

Note: you can add different header and footer layouts. Example:

```
{{ Layout::set('main-1.layout')->header() }}
Sum of two numbers.
5+5 = {= 5+5 }}
{{ Layout::set('main-2.layout')->footer() }}

```

### Pass Information to Views.

[](#pass-information-to-views)

You can pass information to views through an associative array, on the view side you can access the information through a variable with the name of the key related to the corresponding value in the passed associative array.

```
View::set('home',['key'=>$data]);

```

Example:

```
View::set('home',['key'=>$data,'number'=>2022]);

```

In the View 'home':

```
Home View
Data: {= $key }}

Year: {= $number }}

```

### Define a Custom Title on the View.

[](#define-a-custom-title-on-the-view)

Add at the top of the view:

```
{{ Layout::title('MyTitle') }}

```

Add al in the Layout inside title tags:

```

    {{ Layout::titles('PROVISIONAL_TITLE') }}

```

### Define a Custom HEAD Tags (META,JS,CSS) on the View.

[](#define-a-custom-head-tags-metajscss-on-the-view)

Add at the top of the view:

```
{{ Layout::head('') }}

```

Add al in the Layout inside title tags:

```

    Home
    {{ Layout::headCustom() }}

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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

1311d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c0d2a4cc12cc040c434884f6e2abc5b86057dc1045b7d75a9512e267c37e193?d=identicon)[mauutrera](/maintainers/mauutrera)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/vengi-engine/health.svg)

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

###  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)
