josbeir/sugar

A fun and safe PHP templating engine

Maintainers

Package info

github.com/josbeir/sugar

pkg:composer/josbeir/sugar

Statistics

Installs: 1 646

Dependents: 1

Suggesters: 0

Stars: 4

Open Issues: 0

0.6.6 2026-03-11 18:51 UTC

README

Sugar cube Build Status PHPStan Level 10 License: MIT PHP Version codecov Packagist Downloads

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

Read the Documentation

License

Sugar is licensed under the MIT License. See LICENSE.

Contributing

Contributions are welcome. Please read Contributing for setup steps and guidelines.