PHPackages                             lhcgoncalves/leoch - 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. lhcgoncalves/leoch

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

lhcgoncalves/leoch
==================

Leoch is a simple PHP server-side template rendering engine

76PHP

Since Jan 13Pushed 8y ago1 watchersCompare

[ Source](https://github.com/lhcgoncalves/Leoch)[ Packagist](https://packagist.org/packages/lhcgoncalves/leoch)[ RSS](/packages/lhcgoncalves-leoch/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (3)Used By (0)

[![Sele_o_001.png](https://camo.githubusercontent.com/d348dc1e0f66364c5fd935f08133fee4ca49519a7117fb5e3430ef296d334bca/68747470733a2f2f7331372e706f7374696d672e63632f6b6a62767172636d372f53656c655f6f5f3030312e706e67)](https://postimg.org/image/ugmwjtk7v/)

Leoch is a simple PHP server-side template rendering engine.

Demo
----

[](#demo)

See `demo/index.php` for server-side reference and `demo/templates/index.leoch.php` for Leoch syntax reference.

Basic Syntax
------------

[](#basic-syntax)

Variables

```
{{$var}}

```

Conditional Sentences

```
@if[...]

@elseif[...]

@else

@endif

```

Iterators

```
@foreach($array in $var)

I'm a $var

@endforeach

```

Loops

```
@while[$i < 10]

$i++

@endwhile

```

Inside code blocks, there's no need to declare the variable under brackets.

Rendering
---------

[](#rendering)

```
use Leoch\App\Processor\TemplateProcessor;

$template = new Template('demo');
$template->setSrc('example')
         ->fill([
                'somevar' => 'Some Var',
                'level' => 'basic',
                'somenumber' => 2,
                'somearray' => array('Red', 'Blue'),
                'somearray2' => array('Vermelho', 'Azul'),
            ])
         ->render();

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/14a19a3e6a93abfa3fccca0bfb005826c8bbe367ed666cd42df0cc7a74e54b6c?d=identicon)[lhcgoncalves](/maintainers/lhcgoncalves)

---

Tags

packagephprenderingtemplate-enginetemplate-rendering

### Embed Badge

![Health badge](/badges/lhcgoncalves-leoch/health.svg)

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

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