PHPackages                             shemshad/laravel-blade-minify-plus - 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. shemshad/laravel-blade-minify-plus

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

shemshad/laravel-blade-minify-plus
==================================

Minify final Laravel Blade HTML safely with first-class Laravel 8-13 support and beginner-friendly configuration.

v1.2.0(2mo ago)12.5k—0%MITPHPPHP &gt;=8.1

Since Sep 21Pushed 2mo agoCompare

[ Source](https://github.com/arshaparthia/laravel-blade-minify-plus)[ Packagist](https://packagist.org/packages/shemshad/laravel-blade-minify-plus)[ RSS](/packages/shemshad-laravel-blade-minify-plus/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

Laravel Blade Minify Plus
=========================

[](#laravel-blade-minify-plus)

`laravel-blade-minify-plus` is a lightweight package that minifies the final HTML output of Blade views. It is designed to be easy for beginners and stable for production projects.

Why use this package?
---------------------

[](#why-use-this-package)

- Reduces HTML size by removing unnecessary whitespace/comments.
- Keeps Blade templates unchanged (works at the response layer).
- Safe defaults that avoid aggressive transformations.
- Supports **Laravel 8, 9, 10, 11, 12, and 13**.

---

Requirements
------------

[](#requirements)

- PHP **8.1+**
- Laravel **8.x – 13.x**

---

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

[](#installation)

```
composer require shemshad/laravel-blade-minify-plus
```

Laravel auto-discovers the service provider. If auto-discovery is disabled, register it manually:

```
// config/app.php
'providers' => [
    // ...
    BladeMinifyPlus\BladeMinifyPlusServiceProvider::class,
],
```

---

Quick Start (2 minutes)
-----------------------

[](#quick-start-2-minutes)

1. Publish config:

```
php artisan vendor:publish --tag=blade-minify-plus-config
```

2. Add middleware to route(s):

```
use Illuminate\Support\Facades\Route;

Route::view('/about', 'about')->middleware('minify');
```

3. Open your page and inspect the response HTML.

---

Laravel version setup
---------------------

[](#laravel-version-setup)

### Laravel 11, 12, and 13 (bootstrap/app.php)

[](#laravel-11-12-and-13-bootstrapappphp)

Use middleware aliases in `bootstrap/app.php`:

```
use BladeMinifyPlus\Middleware\MinifyHtmlMiddleware;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        commands: __DIR__.'/../routes/console.php',
    )
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->alias([
            'minify' => MinifyHtmlMiddleware::class,
        ]);

        // Optional: apply to all web routes.
        // $middleware->appendToGroup('web', MinifyHtmlMiddleware::class);
    })
    ->create();
```

A full example is available in:

- `examples/bootstrap.app.l12.php`
- `examples/bootstrap.app.l13.php`

### Laravel 10 and earlier (Kernel)

[](#laravel-10-and-earlier-kernel)

Register middleware alias in `app/Http/Kernel.php`:

```
protected $middlewareAliases = [
    // ...
    'minify' => \BladeMinifyPlus\Middleware\MinifyHtmlMiddleware::class,
];
```

For older app skeletons, use `$routeMiddleware` instead of `$middlewareAliases`.

---

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

[](#configuration)

After publishing, edit `config/blade-minify-plus.php`.

### Main options

[](#main-options)

- `enabled` (bool): Global on/off switch.
- `skip_routes` (array): Route names that should not be minified.
- `options` (array): Low-level `voku/html-min` flags.

### Example

[](#example)

```
return [
    'enabled' => env('BLADE_MINIFY_PLUS_ENABLED', true),

    'skip_routes' => [
        'api.docs',
        'webhooks.receive',
    ],

    'options' => [
        'doRemoveComments' => true,
        'doSumUpWhitespace' => true,
    ],
];
```

---

How compatibility is preserved across Laravel versions
------------------------------------------------------

[](#how-compatibility-is-preserved-across-laravel-versions)

This package keeps compatibility by:

- Registering only a middleware alias in the service provider.
- Avoiding hard coupling to app-kernel internals.
- Minifying only eligible HTML responses.
- Skipping streamed/file responses and non-HTML content types.

This means Laravel 13 support is added without breaking Laravel 8-12 behavior.

---

Tips for beginners
------------------

[](#tips-for-beginners)

- Start with route-level middleware first (`->middleware('minify')`).
- Test a few pages before enabling globally.
- Keep advanced `options` at defaults unless you need deeper optimization.
- If a page behaves unexpectedly, add its route name to `skip_routes`.

---

Development checks
------------------

[](#development-checks)

```
php -l src/BladeMinifyPlusServiceProvider.php
php -l src/Middleware/MinifyHtmlMiddleware.php
php -l config/blade-minify-plus.php
```

---

License
-------

[](#license)

MIT

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance86

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~218 days

Total

2

Last Release

67d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c3ccfb5411c127a8eaa4d0ae71db99e10ea198b9a734a77a8a907d687ae60d4?d=identicon)[shemshad](/maintainers/shemshad)

---

Top Contributors

[![arshaparthia](https://avatars.githubusercontent.com/u/21290330?v=4)](https://github.com/arshaparthia "arshaparthia (3 commits)")

---

Tags

middlewarelaravelhtmlminifyblade

### Embed Badge

![Health badge](/badges/shemshad-laravel-blade-minify-plus/health.svg)

```
[![Health](https://phpackages.com/badges/shemshad-laravel-blade-minify-plus/health.svg)](https://phpackages.com/packages/shemshad-laravel-blade-minify-plus)
```

###  Alternatives

[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k12.5k1](/packages/vinkius-labs-laravel-page-speed)[fitztrev/laravel-html-minify

Minifies the HTML output of Laravel 4 applications

427214.1k](/packages/fitztrev-laravel-html-minify)[hasinhayder/tyro-dashboard

Tyro Dashboard - Beautiful admin dashboard for managing Tyro roles, privileges, users, and settings

5443.8k](/packages/hasinhayder-tyro-dashboard)[technikermathe/blade-lucide-icons

A package to easily make use of Lucide icons in your Laravel Blade views.

18421.4k11](/packages/technikermathe-blade-lucide-icons)

PHPackages © 2026

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