PHPackages                             el-schneider/statamic-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. el-schneider/statamic-html-minify

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

el-schneider/statamic-html-minify
=================================

An addon to minify HTML for Statamic v5

v2.0.0(1y ago)0175↓80%1PHPPHP ^8.2CI passing

Since Aug 24Pushed 1y agoCompare

[ Source](https://github.com/el-schneider/statamic-html-minify)[ Packagist](https://packagist.org/packages/el-schneider/statamic-html-minify)[ GitHub Sponsors](https://github.com/el-schneider)[ RSS](/packages/el-schneider-statamic-html-minify/feed)WikiDiscussions master Synced today

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

HTML Minify for Statamic v5
===========================

[](#html-minify-for-statamic-v5)

[![Statamic v5](https://camo.githubusercontent.com/4d095e207279473750930aa5d069581c05fb87c943fb882cd7aa8d81c2cf3edd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53746174616d69632d352e302b2d464632363945)](https://camo.githubusercontent.com/4d095e207279473750930aa5d069581c05fb87c943fb882cd7aa8d81c2cf3edd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53746174616d69632d352e302b2d464632363945)[![PHP](https://camo.githubusercontent.com/d8cb12d4161bcf3d0abb89bdcd751b5c5812aff012d9323cd8cc56633e950041/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322b2d373737424234)](https://camo.githubusercontent.com/d8cb12d4161bcf3d0abb89bdcd751b5c5812aff012d9323cd8cc56633e950041/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322b2d373737424234)[![Test Suite](https://github.com/el-schneider/statamic-html-minify/workflows/Test%20Suite/badge.svg)](https://github.com/el-schneider/statamic-html-minify/workflows/Test%20Suite/badge.svg)

A modern HTML minification addon for Statamic v5 that automatically compresses your website's HTML output, reducing page load times and bandwidth usage.

Features
--------

[](#features)

- **Automatic HTML Minification**: Compresses HTML on every request via middleware
- **Statamic v5 Compatible**: Fully modernized for the latest Statamic version
- **Performance Optimized**: Cached minification engine for optimal performance
- **Developer Friendly**: Skip minification in debug mode during development
- **Highly Configurable**: Comprehensive configuration with environment variable support
- **Error Resilient**: Graceful fallback if minification fails
- **Production Ready**: Battle-tested with comprehensive test suite

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

[](#installation)

Install the addon via Composer:

```
composer require el-schneider/statamic-html-minify
```

Publish the configuration file:

```
php artisan vendor:publish --provider="ElSchneider\HtmlMinify\HtmlMinifyServiceProvider"
```

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

[](#configuration)

The addon provides extensive configuration options via `config/html-minify.php`:

```
return [
    // Enable/disable minification entirely
    'enabled' => env('HTML_MINIFY_ENABLED', true),

    // Skip minification when APP_DEBUG is true
    'skip_on_debug' => env('HTML_MINIFY_SKIP_ON_DEBUG', false),

    // Minification options
    'removeComments' => env('HTML_MINIFY_REMOVE_COMMENTS', true),
    'sumUpWhitespace' => env('HTML_MINIFY_SUM_UP_WHITESPACE', true),
    'removeSpacesBetweenTags' => env('HTML_MINIFY_REMOVE_SPACES_BETWEEN_TAGS', true),

    // ... and many more options
];
```

### Environment Variables

[](#environment-variables)

All configuration options support environment variables for easy deployment:

```
HTML_MINIFY_ENABLED=true
HTML_MINIFY_SKIP_ON_DEBUG=true
HTML_MINIFY_REMOVE_COMMENTS=true
```

Documentation
-------------

[](#documentation)

For detailed configuration options and advanced usage, see the [DOCUMENTATION.md](./DOCUMENTATION.md).

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

[](#requirements)

- PHP 8.2+
- Statamic v5.0+
- Laravel 10/11

Testing
-------

[](#testing)

Run the test suite:

```
vendor/bin/pest
```

Credits
-------

[](#credits)

This addon is maintained by [el-schneider](https://github.com/el-schneider) and builds upon the original work by:

- [Vaggelis Yfantis](https://github.com/octoper) - Original author and creator
- [All Contributors](../../contributors)

Big thanks to Vaggelis for creating this addon and sharing it with the community! 🙏

License
-------

[](#license)

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

Resources
---------

[](#resources)

- [Statamic v5 Docs](https://statamic.dev)
- [Statamic Discord](https://statamic.com/discord)

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance48

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 84.4% 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 ~251 days

Recently: every ~399 days

Total

8

Last Release

381d ago

Major Versions

0.0.5 → v1.x-dev2022-06-11

1.0.0 → v2.0.02025-06-18

PHP version history (3 changes)0.0.5PHP ^7.3|^8.0

v1.x-devPHP ^8.0

v2.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/81a231c7730414820ac67caf7b30bea0de0d6af3775ec941a07ee5dc697f442a?d=identicon)[mail@jonaslist.de](/maintainers/mail@jonaslist.de)

---

Top Contributors

[![octoper](https://avatars.githubusercontent.com/u/6823226?v=4)](https://github.com/octoper "octoper (38 commits)")[![el-schneider](https://avatars.githubusercontent.com/u/26460248?v=4)](https://github.com/el-schneider "el-schneider (5 commits)")[![duncanmcclean](https://avatars.githubusercontent.com/u/19637309?v=4)](https://github.com/duncanmcclean "duncanmcclean (1 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

octoperstatamic-html-minify

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/el-schneider-statamic-html-minify/health.svg)

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

###  Alternatives

[statamic/seo-pro

68516.6k](/packages/statamic-seo-pro)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[rias/statamic-redirect

29335.6k](/packages/rias-statamic-redirect)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3417.0k](/packages/duncanmcclean-statamic-cargo)[jacksleight/statamic-bard-texstyle

18195.4k](/packages/jacksleight-statamic-bard-texstyle)[marcorieser/statamic-livewire

A Laravel Livewire integration for Statamic.

23111.5k15](/packages/marcorieser-statamic-livewire)

PHPackages © 2026

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