PHPackages                             r3c/deval - 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. r3c/deval

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

r3c/deval
=========

Template engine with support for partial evaluation at compilation

1.1.8(1y ago)091MITPHPCI passing

Since Aug 14Pushed 1mo ago1 watchersCompare

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

READMEChangelog (7)DependenciesVersions (3)Used By (0)

Deval: Deferred Evaluation Templates
====================================

[](#deval-deferred-evaluation-templates)

[![Build Status](https://camo.githubusercontent.com/eac996d16ce67ae593eed61d3260dc3818eecb821dccf3475c432d6bb9393918/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7233632f646576616c2f7665726966792e796d6c3f6272616e63683d6d6173746572)](https://github.com/r3c/deval/actions/workflows/verify.yml)[![license](https://camo.githubusercontent.com/2327d38b340554b2a639a8f68ff9960b628a171e4009d4837fe3e6f5d1bb1e7e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7233632f646576616c2e737667)](https://opensource.org/licenses/MIT)

Overview
--------

[](#overview)

Deval is a PHP template engine with support for partial evaluation at compilation to enable early error detection, optimize generated code and improve execution performance.

While most PHP template engines follow a “load variables and render” workflow Deval introduces an intermediate pre-compilation injection step to specify variables that you know won’t change on every rendering. By doing so, Deval will pre-evaluate your template and generate specialized code where all these invariants have been evaluated.

This sample template:

```
{{ $ locale(language, "users.list") }}
{{ for user in users }}
    - {{ $ user.login }}
{{ empty }}
    {{ $ locale(language, "no.users") }}
{{ end }}

```

Will compile a PHP snippet similar to this one after injecting a `locale`function and a `language` variable:

```
Registered user:

    -

    No users registered.

```

As you can see all statements depending on variables locale and language have been evaluated in generated code, as their value was known at compile time. Other variables have been left untouched and Deval expects you to specify their value when rendering the template (and will raise an error if you don’t).

Instructions
------------

[](#instructions)

Either install Deval with [Composer](https://getcomposer.org/) and autoload it:

```
composer require r3c/deval

```

Or download [latest release](https://github.com/r3c/deval/releases/latest) from GitHub then unpack &amp; require manually:

```
require 'path/to/deval/deval.php';

```

Full documentation is available [on Read the Docs](http://deval.readthedocs.io/).

Resource
--------

[](#resource)

- Contact: v.github.com+deval \[at\] mirari \[dot\] fr
- License: [license.md](license.md)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance66

Regular maintenance activity

Popularity5

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

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

2

Last Release

641d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/71fae419dc515275a5fdd7fec738df3b854902df770740fc1be7e522c679b3a5?d=identicon)[r3c](/maintainers/r3c)

---

Top Contributors

[![r3c](https://avatars.githubusercontent.com/u/979446?v=4)](https://github.com/r3c "r3c (201 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![Godzil](https://avatars.githubusercontent.com/u/569162?v=4)](https://github.com/Godzil "Godzil (1 commits)")

---

Tags

deferreddeferred-renderingenginephptemplate

### Embed Badge

![Health badge](/badges/r3c-deval/health.svg)

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

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