phug/compiler
Phug Compiler is the core compiler for the Phug (Pug/Jade) template engine in PHP. It parses Pug's concise, indentation-based syntax and compiles templates into fast, cacheable PHP code, with support for custom dialects, extensions, and Laravel integration.
.pug files (marketing pages, transactional emails, static docs), this directly reduces rewrite scope: keep the templates, swap the runtime.Consider it when:
View::addExtension/finder, compiled-template caching, error surfaces, auto-escaping policy, and escaping-related security review.Look elsewhere when:
@auth/@csrf, component slots, view caching semantics). This is a compiler, not a Laravel view engine — you build that layer.To executives: This is a free, MIT-licensed template compiler that lets us reuse existing Pug templates instead of rewriting them — potentially meaningful savings if we have a template corpus to carry over. It is not a strategic dependency: adoption is thin (4 GitHub stars, no tracked dependents), so I'm recommending a two-sprint evaluation spike on a non-critical surface rather than a platform commitment. Cost of finding out is small; cost of standardizing prematurely is a permanent maintenance and hiring tax.
To engineering: It's a legitimate compiler — lexer, parser, AST, codegen — actively released (March 2026), MIT, and framework-agnostic by design. Two things to be clear about: (1) it compiles, it does not render — you'll pair it with the wider Phug stack and write the Laravel view-engine glue yourself (finder registration, compiled-template cache, error handling, escaping policy); (2) we'd be an early adopter, so we own the integration, the security review of the escaping boundary, and the fork if it stalls. Recommend we prove it on the docs/email pipeline first, measure the glue cost honestly, and only then discuss anything customer-facing.
How can I help you explore Laravel packages today?