Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Pug

Laravel Pug Laravel Package

bkwld/laravel-pug

Adds Pug (formerly Jade) template support to Laravel. Register the .pug extension and write views with Pug's concise, indentation-based syntax—mixins, includes, and layouts included—while Laravel handles rendering and caching. Works alongside Blade templates.

View on GitHub
Deep Wiki
Context7

Pug view adapter for Laravel and Lumen

Frequently asked questions about Laravel Pug
How do I install bkwld/laravel-pug in a Laravel application?
Run composer require bkwld/laravel-pug and let Laravel package auto-discovery register the service provider. Optionally publish the config file if you need to change the view extension or pass options through to the Pug renderer. Then place .pug files in resources/views and render them with view('pages.home') exactly as you would a Blade view. A spike on an existing Laravel app is typically a one to three day job.
Does bkwld/laravel-pug work with Lumen?
Yes, the package is described as a Pug view adapter for Laravel and Lumen. Lumen does not use package auto-discovery, so you register the service provider manually in bootstrap/app.php. You also need to ensure the view component and view paths are enabled, since Lumen turns some of that off by default.
Which Laravel and PHP versions does laravel-pug support?
The package is a thin adapter over Phug, so your effective floor is the intersection of its own constraint and whichever Phug version Composer resolves. Release 2.5.0 widened the phug/phug constraint to permit Phug 2.x, which likely raises the effective PHP requirement on that path. The changelog publishes no test matrix, so verify against your own supported PHP and Laravel combinations before planning an upgrade.
Can I use Pug views and Blade views in the same Laravel app?
Yes. The package registers a .pug extension with Laravel's view finder rather than replacing the Blade compiler, so Blade continues to work normally. Teams commonly introduce Pug for new screens while leaving existing Blade templates untouched. The tradeoff is the ongoing cognitive cost of maintaining two template dialects.
Why should I pin phug/phug explicitly in composer.json?
Version 2.5.0 only widened the phug/phug constraint to allow 2.x, so a floating constraint can resolve Phug 1.x in one environment and Phug 2.x in another from the same composer.json file. Identical source could then compile to different output. Declare either ^1.0 or ^2.0 deliberately and commit the lock file.
Do Pug mixins, includes, and layouts work in Laravel views?
Yes. Parsing and compilation are delegated to Phug, so standard Pug features such as mixins, includes, extends, and block inheritance are available. Paths resolve against the view files under resources/views. Custom keywords and renderer options are set through the package config or the underlying Phug renderer configuration.
How does view caching work with laravel-pug?
Compiled PHP is written into storage/framework/views, the same directory Blade caches into, so Laravel's normal view:clear and view:cache commands apply. After upgrading the package or Phug, force a full view cache clear rather than just warming it. Cached PHP generated by Phug 1 is not guaranteed to be invalidated automatically by a Phug upgrade.
How do I test Pug views in a Laravel test suite?
Pug views render through the standard view pipeline, so assertions like assertViewIs, assertViewHas, and assertSee work as expected. For a migration, render the Pug view and the Blade equivalent and diff the HTML byte for byte. Also compile twice and once more after a cache clear to confirm the output is stable.
Is bkwld/laravel-pug safe to run in production?
Architecturally it is low risk: it is a thin adapter with no persistence, no queue surface, and no runtime services, so it is cheap to adopt and cheap to remove. The real risks are dependency-related, namely non-deterministic Phug resolution, compiler behaviour drift between Phug majors, and stale compiled views. Pin your versions, clear the view cache on deploy, and verify rendered output parity.
What are the alternatives to laravel-pug, and how hard is it to move back to Blade?
Blade ships with Laravel and needs no extra package, while another option is precompiling Pug in a Node toolchain and serving the resulting HTML or partials. Because laravel-pug couples you to the template syntax rather than to runtime services, exit cost is mostly rewriting the templates themselves. Keeping those templates free of heavy custom Phug keywords makes that exit considerably cheaper.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console