PHPackages                             josbeir/sugar - 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. josbeir/sugar

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

josbeir/sugar
=============

A fun and safe PHP templating engine

0.6.6(2mo ago)51.7k↓50%1MITPHPPHP &gt;=8.2CI passing

Since Feb 8Pushed 2mo agoCompare

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

READMEChangelog (10)Dependencies (12)Versions (27)Used By (1)

🍬 Sugar - PHP template engine
=============================

[](#-sugar---php-template-engine)

 [![Sugar cube](docs/static/sugar-cube.svg)](docs/static/sugar-cube.svg)

 [ ![Build Status](https://github.com/josbeir/sugar/actions/workflows/ci.yml/badge.svg) ](https://github.com/josbeir/sugar/actions) [ ![PHPStan Level 10](https://camo.githubusercontent.com/022b70e6631d055205dfebf2aa7e53b3f63e7a3ea04a18e86429f279e29a29f1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c25323031302d627269676874677265656e) ](https://github.com/josbeir/sugar) [ ![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667) ](https://opensource.org/licenses/MIT) [ ![PHP Version](https://camo.githubusercontent.com/744f8821cc27dec8b0013ade48179731a44eadf4f943e0b1d9ffcb93f80177de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e322532422d626c75652e737667) ](https://www.php.net/releases/8.2/en.php) [ ![codecov](https://camo.githubusercontent.com/89a31956a230e3083841fbac5481874eba6a517baef3746149b719e045c0377f/68747470733a2f2f636f6465636f762e696f2f6769746875622f6a6f73626569722f73756761722f67726170682f62616467652e7376673f746f6b656e3d345647574a5154574835) ](https://codecov.io/github/josbeir/sugar) [ ![Packagist Downloads](https://camo.githubusercontent.com/6e1c491d30a4b5dcb220374dc59f6c6fb3db2e2d78ad9522661a8cb22b7c6796/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6f73626569722f7375676172) ](https://packagist.org/packages/josbeir/sugar)

---

A modern PHP (8.2+) templating engine that compiles to pure PHP. Sugar keeps native PHP and HTML intact while adding `s:` attributes for control flow, context-aware escaping, pipe syntax (`|>`) for helpers (a PHP 8.5 feature supported on 8.2+), and composable helpers. Write templates the way you already do, then let the compiler turn them into fast PHP that runs with zero runtime overhead.

Warning

Sugar is under active development. Core features are stable, but the API may change before 1.0.

Documentation and more information
----------------------------------

[](#documentation-and-more-information)

Read the [Documentation](https://josbeir.github.io/sugar/)

License
-------

[](#license)

Sugar is licensed under the MIT License. See [LICENSE](LICENSE.md).

Contributing
------------

[](#contributing)

Contributions are welcome. Please read [Contributing](https://josbeir.github.io/sugar/guide/reference/contributing.html) for setup steps and guidelines.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance86

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

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 ~1 days

Total

17

Last Release

68d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2899d7bd057eecff34549480753213e1b19652f7f726db2d971b6b0fa69d4c14?d=identicon)[josbeir](/maintainers/josbeir)

---

Top Contributors

[![josbeir](https://avatars.githubusercontent.com/u/26058?v=4)](https://github.com/josbeir "josbeir (238 commits)")

---

Tags

phpsecurityperformancetemplatetemplatingcompilertemplate enginedirectivescontext-awarexss-protectionauto-escaping

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/josbeir-sugar/health.svg)

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

###  Alternatives

[eftec/bladeone

The standalone version Blade Template Engine from Laravel in a single php file

8208.4M87](/packages/eftec-bladeone)[phug/phug

Pug (ex-Jade) facade engine for PHP, HTML template engine structured by indentation

67292.2k13](/packages/phug-phug)[eftec/bladeonehtml

The standalone version Blade Template Engine from Laravel in a single php file

1018.1k5](/packages/eftec-bladeonehtml)

PHPackages © 2026

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