PHPackages                             bkwld/laravel-pug - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. bkwld/laravel-pug

ActiveLibrary[Templating &amp; Views](/categories/templating)

bkwld/laravel-pug
=================

Pug view adapter for Laravel

2.5.0(3mo ago)15868.7k↓39%132MITPHPPHP ^7.2 || ^8.0CI failing

Since Jul 20Pushed 3mo ago5 watchersCompare

[ Source](https://github.com/BKWLD/laravel-pug)[ Packagist](https://packagist.org/packages/bkwld/laravel-pug)[ GitHub Sponsors]()[ Fund](https://opencollective.com/pug-php)[ RSS](/packages/bkwld-laravel-pug/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (19)Versions (33)Used By (2)

Laravel Pug
===========

[](#laravel-pug)

[![Packagist](https://camo.githubusercontent.com/4da8a017a0213e344d60c7ff018c70449eb91eaefcb446d95cb897bf8badb463/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626b776c642f6c61726176656c2d7075672e737667)](https://packagist.org/packages/bkwld/laravel-pug)[![GitHub Actions](https://camo.githubusercontent.com/d2383d0cde581258a5022649788d8ebbdc4a4fac31fa945b17455e882a3338b2/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e742e7376673f75726c3d6874747073253341253246253246616374696f6e732d62616467652e6174726f782e646576253246424b574c442532466c61726176656c2d707567253246626164676526266c6162656c3d4275696c64266c6f676f3d6e6f6e65)](https://github.com/BKWLD/laravel-pug/actions)[![StyleCI](https://camo.githubusercontent.com/ab260267a27ef16ff97d55f2cfd09d402795f5c47daec676fae564d0f94f59af/68747470733a2f2f7374796c6563692e696f2f7265706f732f36333733323735312f736869656c643f7374796c653d666c6174)](https://styleci.io/repos/63732751)[![codecov](https://camo.githubusercontent.com/ca63af20aa7432e73897f5d1096b33b316b16fd15d3b7b8f00a6dd56a19d268f/68747470733a2f2f636f6465636f762e696f2f67682f424b574c442f6c61726176656c2d7075672f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/BKWLD/laravel-pug)[![Code Climate](https://camo.githubusercontent.com/adc1d4275668859b1e99dfe7d291d83e367706027510de7378c34b7675453cc9/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f424b574c442f6c61726176656c2d7075672f6261646765732f6770612e737667)](https://codeclimate.com/github/BKWLD/laravel-pug)[![License](https://camo.githubusercontent.com/423658854918f6d74f174e7668868323c388fbb15ab698691e15a1836fe84674/68747470733a2f2f706f7365722e707567782e6f72672f626b776c642f6c61726176656c2d7075672f6c6963656e7365)](https://packagist.org/packages/bkwld/laravel-pug)

A small package that adds support for compiling Pug (Jade) templates to Laravel via [Pug.php](https://github.com/pug-php/pug) (see [complete documentation](https://www.phug-lang.com/)). Both vanilla php and [Blade syntax](https://laravel.com/docs/5.5/blade)is supported within the view.

This is the documentation for the ongoing version 2.0. [Click here to load the documentation for 1.11](https://github.com/BKWLD/laravel-pug/tree/1.11.0#laravel-pug)

Installation
------------

[](#installation)

First you need composer if you haven't yet:

Now open a terminal at the root of your Laravel project. If it's a new project, create it with: `composer create-project --prefer-dist laravel/laravel my-new-project`(replace *my-new-project* with your own project name, [see the documentation for further information](https://laravel.com/docs/5.5#installing-laravel))

Then run:

```
composer require bkwld/laravel-pug

```

Usage
-----

[](#usage)

```
Route::get('/', function () {
    return view('my-page');
});
```

Will now try to load `views/my-page.pug` first, or `views/my-page.blade.pug`or fallback to the default blade engine loading `views/my-page.blade.php`.

As with Blade, you can pass variables to your view:

```
Route::get('/', function () {
    return view('my-page', [
        'user' => Auth::user(),
        'messages' => ['Hello', 'Bye'],
    ]);
});
```

Any file with the extension `.pug` will be compiled as a pug template. Laravel Pug also registers the `.pug.blade` which also compile blade code once Pug code has been compiled; but we highly recommend you to use the clean and standard extension `.pug`that will be recognized by most systems. It compiles your Pug templates in the same way as Blade templates; the compiled template is put in your storage directory. Thus, you don't suffer compile times on every page load.

In other words, just put your Pug files in the regular views directory and name them like `whatever.pug`. You reference them in Laravel like normal such as `view('home.whatever')` for `resources/views/home/whatever.pug`.

The Pug view files can work side-by-side with regular PHP views.

### Use Blade in Pug templates

[](#use-blade-in-pug-templates)

This feature is designed for transition purpose, since every blade features are available in pug, you would not need both.

To use Blade templating within your Pug, just name the files with `.blade.pug` extensions.

 Read moreBe aware that this mode will first render your template with pug, then give the output to render to blade, it means your template must have a valid pug syntax and must render a valid blade template. This also means blade directives are only available through pug text output, see the example below:

```
| @if ($one === 1)
div $one = 1
| @endif
p {{ $two }}
```

If you render this with the following values: `['one' => 1, 'two' => 2]`, you will get:

```
$one = 1
2
```

PS: note that you would get the same output with the following pure pug code:

```
if one === 1
  div $one = 1
p=two
```

### Use in Lumen

[](#use-in-lumen)

Register the service in `bootstrap/app.php`(**Register Service Providers** section is the dedicated place):

```
$app->register(Bkwld\LaravelPug\ServiceProvider::class);
```

Then you can use it with `view()`:

```
$router->get('/', function () use ($router) {
    // will render resources/views/test.pug
    return view('test', [
        'name' => 'Bob',
    ]);
});
```

Configuration
-------------

[](#configuration)

All [Pug.php](https://github.com/pug-php/pug) options are passed through via a Laravel config array file you can edit **/config/laravel-pug.php**

If for any reason, the config file is missing, just run the following command: `php artisan vendor:publish --provider="Bkwld\LaravelPug\ServiceProvider"`

Extending Layouts / Include Sub-views
-------------------------------------

[](#extending-layouts--include-sub-views)

Default root directory for templates is `resources/views`, so from any template any deep in the directory, you can use absolute paths to get other pug files from the root: `extends /layouts/main` will extends the file `resources/views/layouts/main.pug`, `include /partial/foo/bar`, will include `resources/views/partial/foo/bar.pug`. You can use the `basedir` option to set the root to an other directory. Paths that does not start with a slash will be resolved relatively to the current template file.

History
-------

[](#history)

Read the Github [project releases](https://github.com/BKWLD/laravel-pug/releases)for release notes.

###  Health Score

61

—

FairBetter than 98% of packages

Maintenance79

Regular maintenance activity

Popularity46

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 82.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~117 days

Recently: every ~501 days

Total

31

Last Release

111d ago

Major Versions

1.11.0 → 2.0.0-beta.12020-01-22

PHP version history (3 changes)1.0.0PHP &gt;=5.4.0

2.0.0-beta.1PHP ^7.2

2.3.0PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/77567?v=4)[Robert Reinhard](/maintainers/weotch)[@weotch](https://github.com/weotch)

---

Top Contributors

[![kylekatarnls](https://avatars.githubusercontent.com/u/5966783?v=4)](https://github.com/kylekatarnls "kylekatarnls (162 commits)")[![weotch](https://avatars.githubusercontent.com/u/77567?v=4)](https://github.com/weotch "weotch (24 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (3 commits)")[![EmanueleCoppola](https://avatars.githubusercontent.com/u/12816305?v=4)](https://github.com/EmanueleCoppola "EmanueleCoppola (3 commits)")[![pinekta](https://avatars.githubusercontent.com/u/12654165?v=4)](https://github.com/pinekta "pinekta (1 commits)")[![Rivsen](https://avatars.githubusercontent.com/u/762701?v=4)](https://github.com/Rivsen "Rivsen (1 commits)")[![spekulatius](https://avatars.githubusercontent.com/u/8433587?v=4)](https://github.com/spekulatius "spekulatius (1 commits)")[![thelucre](https://avatars.githubusercontent.com/u/4340866?v=4)](https://github.com/thelucre "thelucre (1 commits)")[![maxfromua](https://avatars.githubusercontent.com/u/9142824?v=4)](https://github.com/maxfromua "maxfromua (1 commits)")

---

Tags

jadelaravellumenpug

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bkwld-laravel-pug/health.svg)

```
[![Health](https://phpackages.com/badges/bkwld-laravel-pug/health.svg)](https://phpackages.com/packages/bkwld-laravel-pug)
```

###  Alternatives

[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

725173.2k14](/packages/tallstackui-tallstackui)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
