phug/formatter
A formatting extension for Phug, the PHP Pug template engine. It pretty-prints and normalizes Pug source with configurable options, helping keep templates readable and consistent in Laravel and PHP projects.
Architecture fit
phug/formatter is a pure-PHP library, not a service. It consumes the Phug AST (hence the repo link to phug-php/ast) and re-serializes Pug source. It has no framework coupling — it will drop into any Composer-managed PHP 8.x codebase, Laravel included.phug/renderer or tale-pug, this is a natural dev-tooling dependency. If the stack is Blade-only, there is no fit and no reason to read further.require-dev, invoked from CLI/CI — not from request-cycle code.Integration feasibility
composer require --dev phug/formatter, instantiate the formatter, pass source strings, get formatted Pug back. Expect a thin artisan pug:format wrapper to be a day of work.Technical risk
phug/formatter but the listed repository is phug-php/ast. For a supply-chain or license audit, this is a provenance gap that must be resolved before adoption. MIT is confirmed, which mitigates the licensing dimension.Key questions
phug/ast and phug/parser versions does the formatter constrain, and are those constraints tight enough to prevent silent AST-node drift?|, pre, textarea, inline tags) without changing rendered output?include/extends/block/mixin — single-file only, or does it traverse?ast rather than formatter? Is the formatter actually part of that monorepo, and is the released package built from it?Stack fit
phug/ast and a parser transitively, so your effective surface is three packages, not one.composer.json. Do not rely on transitive resolution — with zero dependents there is no ecosystem pressure keeping these versions coherent.Migration path
.pug files and classify by feature usage (mixin-heavy, include-heavy, plain markup). Format only a representative subset first.--check (fail on unformatted) only after the render-diff suite is green and stable across two weeks.Compatibility
npm/make shortcut rather than expecting format-on-save.Sequencing
Maintenance
Support
Scaling
Failure modes
phug/ast refactor breaks node handling after a composer update. Mitigate: pin exact versions, renovate with manual approval.Ramp-up
Bottom line: adopt as a require-dev convenience with a pinned fork-ready posture and a mandatory render-diff gate. Do not treat it as infrastructure, and resolve the repository-provenance mismatch before it enters the dependency graph.
How can I help you explore Laravel packages today?