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.
Read the Documentation
Sugar is licensed under the MIT License. See LICENSE.
Contributions are welcome. Please read Contributing for setup steps and guidelines.