PHPackages                             sonnn/html-minify - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sonnn/html-minify

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sonnn/html-minify
=================

Minifies the HTML output of Laravel applications

v3.0(8y ago)09PHP

Since Jul 27Pushed 8y ago1 watchersCompare

[ Source](https://github.com/sonnam0904/html-minify)[ Packagist](https://packagist.org/packages/sonnn/html-minify)[ Docs](https://github.com/sonnn/html-minify)[ RSS](/packages/sonnn-html-minify/feed)WikiDiscussions master Synced 6d ago

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

UPDATE for Laravel 5/5.1+
-------------------------

[](#update-for-laravel-551)

Read my preferred way of minifying HTML in Laravel 5/5.1+ apps here: [Using Gulp to Minify Laravel Blade Templates](https://github.com/fitztrev/laravel-html-minify/wiki/Laravel-5---5.1-HTML-Minifying)

---

Laravel HTML Minify
===================

[](#laravel-html-minify)

### For Laravel 4 - See [here](https://github.com/fitztrev/laravel-html-minify/wiki/Laravel-5---5.1-HTML-Minifying) for L5+

[](#for-laravel-4---see-here-for-l5)

[![Total Downloads](https://camo.githubusercontent.com/9db452ff1b70690771b0ff10acea87b213f927a588d7a20c96e84573a757395f/68747470733a2f2f706f7365722e707567782e6f72672f6669747a747265762f6c61726176656c2d68746d6c2d6d696e6966792f646f776e6c6f6164732e706e67)](https://github.com/sonnam0904/html-minify)

About
-----

[](#about)

This package compresses the HTML output from your Laravel 4 application, seamlessly reducing the overall response size of your pages.

Other scripts that I've seen will compress the HTML output on-the-fly for each request. Instead, this package extends the Blade compiler to save the compiled template files to disk in their compressed state, reducing the overhead for each request.

Why?
----

[](#why)

Even with gzip enabled, there is still an improvement in the response size for HTML content-type documents.

Test Pagew/o Gzipw/ Gzipw/ Gzip + Laravel HTML Minify**\#1**8,039 bytes1,944 bytes**1,836 bytes** (5.6% improvement)**\#2**377,867 bytes5,247 bytes**4,314 bytes** (17.8% improvement)Installation
------------

[](#installation)

1. Add `"sonnn/html-minify": "1.*"` to **composer.json**.
2. Run `composer update`
3. Add `Sonnn\HtmlMinify\LaravelHtmlMinifyServiceProvider` to the list of providers in **app/config/app.php**.
4. **Important:** You won't see any changes until you edit your `*.blade.php` template files. Once Laravel detects a change, it will recompile them, which is when this package will go to work. To force all views to be recompiled, just run this command: `find . -name "*.blade.php" -exec touch {} \;`

Config
------

[](#config)

Optionally, you can choose to customize how the minifier functions for different environments. Publish the configuration file and edit accordingly.

```
$ php artisan config:publish sonnn/html-minify

```

### Options

[](#options)

- **`enabled`** - *boolean*, default **true**

If you are using a javascript framework that conflicts with Blade's tags, you can change them.

- **`blade.contentTags`** - *array*, default `{{` and `}}`
- **`blade.escapedContentTags`** - *array*, default `{{{` and `}}}`

#### Skipping minification

[](#skipping-minification)

To prevent the minification of a view file, add `skipmin` somewhere in the view.

```
{{-- skipmin --}}

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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 ~0 days

Total

2

Last Release

3216d ago

Major Versions

v2.0 → v3.02017-07-27

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5780387?v=4)[Son Nguyen](/maintainers/sonnn)[@sonnn](https://github.com/sonnn)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sonnn-html-minify/health.svg)

```
[![Health](https://phpackages.com/badges/sonnn-html-minify/health.svg)](https://phpackages.com/packages/sonnn-html-minify)
```

###  Alternatives

[yajra/laravel-datatables-oracle

jQuery DataTables API for Laravel

4.9k33.8M339](/packages/yajra-laravel-datatables-oracle)[cknow/laravel-money

Laravel Money

1.0k4.3M22](/packages/cknow-laravel-money)[livewire/flux

The official UI component library for Livewire.

9385.0M86](/packages/livewire-flux)[akaunting/laravel-money

Currency formatting and conversion package for Laravel

7825.3M18](/packages/akaunting-laravel-money)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[spatie/laravel-dashboard

A dashboard for Laravel

568156.1k94](/packages/spatie-laravel-dashboard)

PHPackages © 2026

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