PHPackages                             abordage/laravel-html-min - 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. abordage/laravel-html-min

ActiveLibrary

abordage/laravel-html-min
=========================

HtmlMin is very simple (and very fast) html compression package for Laravel

1.0.0(4mo ago)2569.1k↓23.7%3[1 PRs](https://github.com/abordage/laravel-html-min/pulls)MITPHPPHP &gt;=7.4CI passing

Since Jun 13Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/abordage/laravel-html-min)[ Packagist](https://packagist.org/packages/abordage/laravel-html-min)[ Docs](https://github.com/abordage/laravel-html-min)[ RSS](/packages/abordage-laravel-html-min/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (15)Used By (0)

HtmlMin: Laravel package for HTML minification
==============================================

[](#htmlmin-laravel-package-for-html-minification)

Very simple (and very fast) html compression.

 [![Laravel HtmlMin](https://github.com/abordage/laravel-html-min/raw/master/docs/images/abordage-laravel-html-min-cover.png?raw=true)](https://github.com/abordage/laravel-html-min/blob/master/docs/images/abordage-laravel-html-min-cover.png?raw=true)

[ ![Packagist Version](https://camo.githubusercontent.com/b91fc88b383152ae4ed41095017db161c2aa9ec22a7c0a986ff3dd5d2aa2c5e2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61626f72646167652f6c61726176656c2d68746d6c2d6d696e)](https://packagist.org/packages/abordage/laravel-html-min "Packagist version")[ ![GitHub Tests Status](https://camo.githubusercontent.com/1a860051f8e3f6f4a726752eb0f7fb5c5fe9e5cdc696450eae63c04dfaf0a650/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61626f72646167652f6c61726176656c2d68746d6c2d6d696e2f74657374732e796d6c3f6c6162656c3d7465737473)](https://github.com/abordage/laravel-html-min/actions/workflows/tests.yml "GitHub Tests Status")[ ![GitHub Code Style Status](https://camo.githubusercontent.com/53f10432a6b4ac44c409d9724f7f8b6af656fff611200ef92efad8489104c38e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61626f72646167652f6c61726176656c2d68746d6c2d6d696e2f7068702d63732d66697865722e796d6c3f6c6162656c3d636f64652532307374796c65)](https://github.com/abordage/laravel-html-min/actions/workflows/tests.yml "GitHub Code Style Status")[ ![PHP Version Support](https://camo.githubusercontent.com/905a783d1e751b33809f4938892a3f1ae29aaf4ca364748224f23195be625695/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f61626f72646167652f6c61726176656c2d68746d6c2d6d696e)](https://www.php.net/ "PHP version")[ ![License](https://camo.githubusercontent.com/4fe652aa6e2f3acf300bd8013259f545436c50ba15c7e7792bbba4722d3cb7a9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f61626f72646167652f6c61726176656c2d68746d6c2d6d696e)](https://github.com/abordage/laravel-html-min/blob/master/README.md "License")

Features
--------

[](#features)

- Removing extra whitespaces
- Removing html comments (works correctly with `livewire/livewire` comments)
- Removing trailing slashes from void elements (HTML5)
- Skip `textarea`, `pre` and `script` elements
- Very fast. See benchmark

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

[](#requirements)

- PHP 7.4 or higher (7.4, 8.0, 8.1, 8.2, 8.3, 8.4)
- Laravel 8.x - 12.x

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

[](#installation)

You can install the package via composer:

```
composer require abordage/laravel-html-min
```

You can publish the config file with:

```
php artisan vendor:publish --tag="html-min-config"
```

Usage
-----

[](#usage)

To enable compression just register middleware:

```
// app/Http/Kernel.php

protected $middleware = [
    'web' => [
        // other middleware

        \Abordage\LaravelHtmlMin\Middleware\HtmlMinify::class,
    ],

    // ...
];
```

It's all. Optionally you can change the settings in `config/html-min.php`

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

[](#configuration)

OptionDefaultDescription`enable``true`Enable/disable HTML minification`find_doctype_in_document``true`Skip minification if DOCTYPE not found`remove_whitespace_between_tags``true`Remove whitespace between tags`remove_blank_lines_in_script_elements``false`Remove blank lines in ```remove_trailing_slashes``false`Convert `` to ``See `config/html-min.php` for detailed descriptions.

Benchmark
---------

[](#benchmark)

See [abordage/html-min-benchmark](https://github.com/abordage/html-min-benchmark)

Testing
-------

[](#testing)

```
composer test:all
```

or

```
composer test:phpunit
composer test:phpstan
composer test:phpcsf
```

or see

Feedback
--------

[](#feedback)

If you have any feedback, comments or suggestions, please feel free to open an issue within this repository.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/abordage/.github/blob/master/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Pavel Bychko](https://github.com/abordage)
- [All Contributors](https://github.com/abordage/laravel-html-min/graphs/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance82

Actively maintained with recent releases

Popularity41

Moderate usage in the ecosystem

Community14

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.7% 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 ~144 days

Recently: every ~321 days

Total

10

Last Release

134d ago

Major Versions

0.2.2 → 1.0.02026-01-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/c87a6833167a0a9698e160af28d0c4bbc1813a672ca5dc8a83fbc5cdd7714e06?d=identicon)[abordage](/maintainers/abordage)

---

Top Contributors

[![abordage](https://avatars.githubusercontent.com/u/28537731?v=4)](https://github.com/abordage "abordage (60 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (25 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (18 commits)")[![phunsok](https://avatars.githubusercontent.com/u/51017504?v=4)](https://github.com/phunsok "phunsok (1 commits)")

---

Tags

html-minifierlaravel-htmlminhtml minifierHTML minifyhtml minificationhtml compresshtml min

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/abordage-laravel-html-min/health.svg)

```
[![Health](https://phpackages.com/badges/abordage-laravel-html-min/health.svg)](https://phpackages.com/packages/abordage-laravel-html-min)
```

###  Alternatives

[htmlmin/htmlmin

HTMLMin Is A Simple HTML Minifier For Laravel 5

1.0k1.9M9](/packages/htmlmin-htmlmin)[fahlisaputra/laravel-minify

Minify your blade views, html, css and obfuscate js files on the fly. Lightweight minifier for your Laravel project.

150157.0k1](/packages/fahlisaputra-laravel-minify)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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