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

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

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

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

1.0.0(6mo ago)2579.0k↓64.4%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 2d ago

READMEChangelog (10)Dependencies (7)Versions (17)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 95% of packages

Maintenance78

Regular maintenance activity

Popularity41

Moderate usage in the ecosystem

Community14

Small or concentrated contributor base

Maturity57

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

180d 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

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

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

The Illuminate Pagination package.

12234.1M1.0k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9349.2M282](/packages/illuminate-pipeline)[illuminate/redis

The Illuminate Redis package.

8314.6M375](/packages/illuminate-redis)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)

PHPackages © 2026

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