pug-php/pug
Pug-php/pug brings the Pug (formerly Jade) template engine to PHP. Write clean, indentation-based templates that compile to HTML, with Laravel integration, caching, and a concise syntax for faster, more readable views.
Architecture fit. pug-php/pug is an indentation-sensitive template DSL (Jade lineage) that compiles templates into PHP, which then renders through Laravel's view layer. Architecturally it is a presentation-layer substitution, not a framework change: it plugs into illuminate/view by extending the view finder/engine so .pug files resolve alongside .blade.php. Because output is compiled PHP, it inherits OPcache and the existing PHP-FPM/queue execution model — no Node runtime is required for the default PHP compilation path (confirm this for your chosen renderer mode). That makes it a low-blast-radius fit for teams that already think in Pug, and a net-new syntax burden for Blade-native teams.
Integration feasibility. A proof of concept is days, not weeks: Composer install, service-provider auto-discovery, config publish, register the .pug extension, render one layout. The real integration cost is not installation but the Blade ergonomics gap. @csrf, @vite, @livewire, @error, @auth, @lang, component tags, and slots have no native Pug equivalents; each needs a helper function, custom keyword, or filter. Treat that helper layer as first-class product surface — it must be versioned, documented, and tested, or every feature team reinvents it.
Technical risk.
phug/*-style sub-packages, which multiplies the audit surface).!=, !{}) needs a lint rule.Key questions.
@vite, Livewire, or Inertia interop on the same pages? If yes, the coexistence design must be settled before migration.Stack fit. Strong where Pug fluency already exists (teams with Node/Jade history) and for HTML email templates, static marketing pages, and print/PDF surfaces where table-heavy markup and inline styling are common. Weak for application UI that leans on Livewire, Blade components, or heavy directive usage. The decision is best framed per surface, not per application.
Migration path. Incremental and reversible. Phase 1: a single low-risk surface (transactional emails or a landing page) with a shared layout and partials. Phase 2: extract shared fragments into a small component/helper library covering CSRF, asset tags, translations, and auth conditionals. Phase 3: migrate additional presentational pages only after the helper layer and cache story are proven. Keep Blade as the default engine throughout; dual-engine operation is a supported configuration, not a temporary hack, and should be documented as such.
Compatibility. Pin the core package, any Laravel bridge, and the underlying compiler packages to exact tested versions; verify their constraints against illuminate/view and the production PHP minor version. Run the same PHP version in CI as in production — compiled output and indentation/lexer behavior are the kind of thing that differs at the margins. Add a CI job that compiles every template so syntax errors fail the build rather than a request.
Sequencing.
Maintenance. Budget roughly one to two engineer-days per quarter for version bumps and compatibility testing, plus ongoing ownership of the in-house helper layer (which will likely outgrow the upstream package in change volume). Pin versions and upgrade deliberately; avoid floating constraints. Because templates are plain text, the exit back to Blade is mechanical but non-trivial — estimate it per migrated surface and record it, so the dependency never becomes load-bearing without a stated reversal cost.
Support. Community-only: GitHub issues, no vendor SLA. Name an internal owner (frontend platform or backend guild) with a documented escalation path. Establish a policy for how long the team may run an unpatched version and who watches upstream security advisories. Avoid adopting it for surfaces with regulatory or contractual support obligations unless the owner signs off.
Scaling. Compilation is the only expensive step; warm renders are ordinary PHP and scale with the existing fleet. The operational work is cache lifecycle: the compiled-template directory must be writable, sufficiently sized, and either persisted or warmed per pod. On containerized/autoscaled deployments, prefer baking a warmed cache into the image or running a warm-up step post-deploy; otherwise the first request per pod pays compile cost and a burst of cold pods can produce a latency spike. Lock contention on concurrent first-compiles of the same template is a known class of issue — verify behavior under load.
Failure modes to plan for.
Ramp-up. Expect one to two weeks for a Blade-fluent developer to become productive, and longer before they write reviewable, idiomatic templates. Editor and formatter support exists but is materially weaker than for Blade, so add a linter (Pug-style) and a short style guide to CI and onboarding. Mitigate with a component/helper catalog, one canonical example per pattern (forms, tables, conditionals, loops, escaping), and a pairing rotation while the first surfaces migrate. Track onboarding cost explicitly — if it exceeds the measured rendering or ergonomics benefit, the honest recommendation is to stop at the email/static-page use case.
How can I help you explore Laravel packages today?