PHPackages                             novay/htmlmin - 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. [Framework](/categories/framework)
4. /
5. novay/htmlmin

ActiveLibrary[Framework](/categories/framework)

novay/htmlmin
=============

HTMLMin Is A Simple HTML Minifier For Laravel 5

1.0.0(1y ago)017MITPHPPHP &gt;=5.5.9

Since Jun 19Pushed 1y agoCompare

[ Source](https://github.com/novay/htmlmin)[ Packagist](https://packagist.org/packages/novay/htmlmin)[ RSS](/packages/novay-htmlmin/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

Laravel HTMLMin
===============

[](#laravel-htmlmin)

Laravel HTMLMin is currently maintained by [Raza Mehdi](https://github.com/srmklive), and is a simple HTML minifier for [Laravel](http://laravel.com). It utilises Mr Clay's [Minify](https://github.com/mrclay/minify) package to minify entire responses, but can also minify blade at compile time. Feel free to check out the [change log](CHANGELOG.md), [releases](https://github.com/HTMLMin/Laravel-HTMLMin/releases), [license](LICENSE), and [contribution guidelines](CONTRIBUTING.md).

![]()[![Tests](https://github.com/HTMLMin/Laravel-HTMLMin/workflows/HTMLMinTests/badge.svg)](https://github.com/HTMLMin/Laravel-HTMLMin/workflows/HTMLMinTests/badge.svg)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Latest Version](https://camo.githubusercontent.com/bebbad868e280b7dd4080399917550f1f35dee77ea9372782a9cd115b281cbd1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f48544d4c4d696e2f4c61726176656c2d48544d4c4d696e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/HTMLMin/Laravel-HTMLMin/releases)

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

[](#installation)

Laravel HTMLMin requires [PHP](https://php.net) 5.5+. This particular version supports Laravel 5.1-5.8, 6.x, 7.x and 8.x.

To get the latest version, simply require the project using [Composer](https://getcomposer.org):

```
$ composer require htmlmin/htmlmin
```

Once installed, register the service provider in your `config/app.php`

```
'providers' => [
    HTMLMin\HTMLMin\HTMLMinServiceProvider::class
]
```

If you want, a facade is available to alias

```
'aliases' => [
    'HTMLMin' => HTMLMin\HTMLMin\Facades\HTMLMin::class
]
```

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

[](#configuration)

Laravel HTMLMin supports optional configuration.

To get started, you'll need to publish all vendor assets:

```
$ php artisan vendor:publish
```

This will create a `config/htmlmin.php` file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

There are three config options:

##### Automatic Blade Optimizations

[](#automatic-blade-optimizations)

This option (`'blade'`) enables minification of the blade views as they are compiled. These optimizations have little impact on php processing time as the optimizations are only applied once and are cached. This package will do nothing by default to allow it to be used without minifying pages automatically. The default value for this setting is `false`.

##### Force Blade Optimizations

[](#force-blade-optimizations)

This option (`'force'`) forces blade minification on views where there such minification may be dangerous. This should only be used if you are fully aware of the potential issues this may cause. Obviously, this setting is dependent on blade minification actually being enabled. The default value for this setting is `false`.

##### Ignore Blade Files

[](#ignore-blade-files)

This option (`'ignore'`) is where you can specify paths, which you don't want to minify. A sensible default for this setting is provided.

Usage
-----

[](#usage)

##### HTMLMin

[](#htmlmin)

This is the class of most interest. It is bound to the ioc container as `'htmlmin'` and can be accessed using the `Facades\HTMLMin` facade. There are four public methods of interest.

The `'blade'` method will parse a string as blade and minify it as quickly as possible. This is method the compiler class uses when blade minification is enabled.

The `'css'` and `'js'` methods will parse a string as css/js and will minify it using Mr Clay's [Minify](https://github.com/mrclay/minify) package.

The `'html'` method will parse a string as html and will minify it as best as possible using Mr Clay's [Minify](https://github.com/mrclay/minify) package. It will also be able to minify inline css and js. This is the method that is used by the minification middleware.

##### Facades\\HTMLMin

[](#facadeshtmlmin)

This facade will dynamically pass static method calls to the `'htmlmin'` object in the ioc container which by default is the `HTMLMin` class.

##### Minifiers\\MinifierInterface

[](#minifiersminifierinterface)

This interface defines the public method a minifier class must implement. Such a class must only provide a `'render'` method which takes one parameter as a string, and should return a string. This package ships with 4 implementations of this interface, but these classes are not intended for public use, so have no been documented here. You can see the source [here](https://github.com/HTMLMin/Laravel-HTMLMin/tree/master/src/Minifiers).

##### Http\\Middleware\\MinifyMiddleware

[](#httpmiddlewareminifymiddleware)

You may put the `HTMLMin\HTMLMin\Http\Middleware\MinifyMiddleware` middleware in front of your routes to live minify them. Note that this middleware allows you to achieve maximal results, though at a performance cost because of it running on each request instead of once like the built in blade minification. It may be useful for you to take a look at the [source](https://github.com/HTMLMin/Laravel-HTMLMin/blob/master/src/Http/Middleware/MinifyMiddleware.php) for this, read the [tests](https://github.com/HTMLMin/Laravel-HTMLMin/blob/master/tests/Functional/MiddlewareTest.php), or check out Laravel's [documentation](http://laravel.com/docs/5.1/middleware) if you need to.

##### Skipping Minification

[](#skipping-minification)

As well as being able to skip folders using the (`'ignore'`) config, there are occasions where you will want to 'skip' single files.

Just add the following comment to each file you want to skip:

```

```

Please note that if you use (`'force'`) option in the config it will not work.

##### HTMLMinServiceProvider

[](#htmlminserviceprovider)

This class contains no public methods of interest. This class should be added to the providers array in `config/app.php`. This class will setup ioc bindings and register automatic blade minification based on the config.

##### Further Information

[](#further-information)

There are other classes in this package that are not documented here (such as the compiler class). This is because they are not intended for public use and are used internally by this package.

**Please note to clear view cache to see changes.**

```
php artisan view:clear

```

Security
--------

[](#security)

If you discover a security vulnerability within this package, please send an e-mail to Raza Mehdi at . All security vulnerabilities will be promptly addressed.

License
-------

[](#license)

Laravel HTMLMin is licensed under [The MIT License (MIT)](LICENSE).

###  Health Score

23

—

LowBetter than 30% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 90.3% 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

Unknown

Total

1

Last Release

640d ago

### Community

Maintainers

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

---

Top Contributors

[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (409 commits)")[![srmklive](https://avatars.githubusercontent.com/u/839335?v=4)](https://github.com/srmklive "srmklive (19 commits)")[![KristofMorva](https://avatars.githubusercontent.com/u/5695015?v=4)](https://github.com/KristofMorva "KristofMorva (2 commits)")[![novay](https://avatars.githubusercontent.com/u/712577?v=4)](https://github.com/novay "novay (2 commits)")[![rodrigopedra](https://avatars.githubusercontent.com/u/5470108?v=4)](https://github.com/rodrigopedra "rodrigopedra (2 commits)")[![danwall](https://avatars.githubusercontent.com/u/827274?v=4)](https://github.com/danwall "danwall (2 commits)")[![guidocella](https://avatars.githubusercontent.com/u/11783568?v=4)](https://github.com/guidocella "guidocella (1 commits)")[![miladnouri](https://avatars.githubusercontent.com/u/3003901?v=4)](https://github.com/miladnouri "miladnouri (1 commits)")[![mul14](https://avatars.githubusercontent.com/u/113989?v=4)](https://github.com/mul14 "mul14 (1 commits)")[![mweghorst](https://avatars.githubusercontent.com/u/9582326?v=4)](https://github.com/mweghorst "mweghorst (1 commits)")[![phuongnamsoft](https://avatars.githubusercontent.com/u/4836324?v=4)](https://github.com/phuongnamsoft "phuongnamsoft (1 commits)")[![scottbedard](https://avatars.githubusercontent.com/u/7980426?v=4)](https://github.com/scottbedard "scottbedard (1 commits)")[![Shonetow](https://avatars.githubusercontent.com/u/4283547?v=4)](https://github.com/Shonetow "Shonetow (1 commits)")[![shovhan](https://avatars.githubusercontent.com/u/37126140?v=4)](https://github.com/shovhan "shovhan (1 commits)")[![tehwave](https://avatars.githubusercontent.com/u/4569897?v=4)](https://github.com/tehwave "tehwave (1 commits)")[![xel1045](https://avatars.githubusercontent.com/u/1497697?v=4)](https://github.com/xel1045 "xel1045 (1 commits)")[![andreiio](https://avatars.githubusercontent.com/u/1569300?v=4)](https://github.com/andreiio "andreiio (1 commits)")[![ziishaned](https://avatars.githubusercontent.com/u/16267321?v=4)](https://github.com/ziishaned "ziishaned (1 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")[![bramburn](https://avatars.githubusercontent.com/u/11090413?v=4)](https://github.com/bramburn "bramburn (1 commits)")

---

Tags

frameworklaravelhtmlminifierhtmlminhtml minifierLaravel HTMLMin

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/novay-htmlmin/health.svg)

```
[![Health](https://phpackages.com/badges/novay-htmlmin/health.svg)](https://phpackages.com/packages/novay-htmlmin)
```

###  Alternatives

[htmlmin/htmlmin

HTMLMin Is A Simple HTML Minifier For Laravel 5

1.0k1.9M8](/packages/htmlmin-htmlmin)[laravel/lumen-framework

The Laravel Lumen Framework.

1.5k25.9M642](/packages/laravel-lumen-framework)[graham-campbell/markdown

Markdown Is A CommonMark Wrapper For Laravel

1.4k7.0M58](/packages/graham-campbell-markdown)[avored/framework

This is my package framework

7816.5k5](/packages/avored-framework)[laravelbook/laravel4-powerpack

Port of Laravel 3's HTML, Form and Str classes

833.8k](/packages/laravelbook-laravel4-powerpack)

PHPackages © 2026

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