PHPackages                             kenangundogan/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. kenangundogan/htmlmin

ActiveLibrary[Framework](/categories/framework)

kenangundogan/htmlmin
=====================

HTMLMin Is A Simple HTML Minifier For Laravel

v1.0.1(1mo ago)029.5k↓48.7%MITPHPPHP &gt;=7.3

Since Dec 16Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/kenangundogan/Laravel-HTMLMin)[ Packagist](https://packagist.org/packages/kenangundogan/htmlmin)[ RSS](/packages/kenangundogan-htmlmin/feed)WikiDiscussions main Synced 1w ago

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

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

[](#laravel-htmlmin)

Laravel HTMLMin, developed by [Kenan Gündoğan](https://github.com/kenangundogan), is a simple **HTML minifier** package for [Laravel](http://laravel.com). This package uses **Mr Clay's [Minify](https://github.com/mrclay/minify)** library to minify entire HTTP responses. It can also minify **Blade** views at compile time.

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

---

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

[](#installation)

Laravel HTMLMin requires **PHP 7.3+** and is compatible with **Laravel 7.x, 8.x, 9.x, 10.x, 11.x**, and 13.x. You can install the package using Composer:

```
composer require kenangundogan/htmlmin
```

### Automatic Loading

[](#automatic-loading)

The package is automatically loaded using Laravel's `extra` configuration. There is no need to manually register the Service Provider.

---

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

[](#configuration)

Laravel HTMLMin configuration is optional. You can publish the configuration file using the following command:

```
php artisan vendor:publish
```

This will create a `config/htmlmin.php` file, which you can modify to suit your project's needs.

### Configuration Options

[](#configuration-options)

1. **Automatic Blade Optimizations** (`blade`)
    Enables automatic minification of Blade views during compilation.
    Default: `false`
2. **Force Blade Optimizations** (`force`)
    Forces minification even on risky Blade views. Use with caution.
    Default: `false`
3. **Ignore Blade Files** (`ignore`)
    Specify file paths to exclude from minification.
    Example:

    ```
    'ignore' => [
        'resources/views/emails',
        'resources/views/markdown',
    ],
    ```

---

Usage
-----

[](#usage)

### HTMLMin Class

[](#htmlmin-class)

The `HTMLMin` class is bound to the IOC container as `htmlmin` and provides the following methods:

- **`blade($value)`**: Quickly minifies a Blade string.
- **`css($value)`**: Minifies CSS content.
- **`js($value)`**: Minifies JavaScript content.
- **`html($value)`**: Minifies HTML content, including inline CSS and JS.

#### Example Usage:

[](#example-usage)

```
use HTMLMin\HTMLMin\Facades\HTMLMin;

echo HTMLMin::html('    Hello World!    ');
```

---

### Middleware Usage

[](#middleware-usage)

You can use middleware to minify HTML responses live. Add the middleware to your routes:

```
use HTMLMin\HTMLMin\Http\Middleware\MinifyMiddleware;

Route::middleware([MinifyMiddleware::class])->group(function () {
    Route::get('/', function () {
        return view('welcome');
    });
});
```

**Note:** Middleware runs on every request and may have a performance cost. For better performance, consider using Blade minification.

---

### Skipping Minification

[](#skipping-minification)

If you want to exclude certain files or views from minification:

- **Using Config**:
    Add file paths to the `ignore` setting in `config/htmlmin.php`.
- **Using HTML Comments**:
    Add the following comment within the file: ```

    ```

---

Clearing Cache
--------------

[](#clearing-cache)

To apply changes, you may need to clear Laravel's view cache:

```
php artisan view:clear
```

---

License
-------

[](#license)

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

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance91

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

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

Total

2

Last Release

41d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19374764?v=4)[Kenan Gündoğan](/maintainers/kenangundogan)[@kenangundogan](https://github.com/kenangundogan)

---

Top Contributors

[![kenangundogan](https://avatars.githubusercontent.com/u/19374764?v=4)](https://github.com/kenangundogan "kenangundogan (6 commits)")

---

Tags

frameworklaravelhtmlminifierhtmlminhtml minifierLaravel HTMLMin

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[htmlmin/htmlmin

HTMLMin Is A Simple HTML Minifier For Laravel 5

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

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k28.4M134](/packages/laravel-cashier)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

76318.2M110](/packages/laravel-mcp)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k14.1M120](/packages/laravel-pulse)[moonshine/moonshine

Laravel administration panel

1.3k239.9k72](/packages/moonshine-moonshine)

PHPackages © 2026

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