PHPackages                             vmpublishing/slim-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. vmpublishing/slim-html-minify

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

vmpublishing/slim-html-minify
=============================

A minification middleware based on voku/HtmlMin using psr-15

2.0.2(6y ago)2213[1 issues](https://github.com/vmpublishing/slim-html-minify/issues)MITPHP

Since May 27Pushed 6y ago1 watchersCompare

[ Source](https://github.com/vmpublishing/slim-html-minify)[ Packagist](https://packagist.org/packages/vmpublishing/slim-html-minify)[ RSS](/packages/vmpublishing-slim-html-minify/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (5)Versions (5)Used By (0)

[![Build Status](https://camo.githubusercontent.com/739931d71265b6f346370d989eb46e2b59608818b206664a0eafb3d3b888e232/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766d7075626c697368696e672f736c696d2d68746d6c2d6d696e6966792f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vmpublishing/slim-html-minify/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/8e7c8688d8ab1413cb48e57fc07ec806ad733dcddd6b38cd71a7f045c157509e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766d7075626c697368696e672f736c696d2d68746d6c2d6d696e6966792f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vmpublishing/slim-html-minify/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/072034be671e2c7d4fd9f00ff3363031eee79460643611d93abf08a3faa50cfd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766d7075626c697368696e672f736c696d2d68746d6c2d6d696e6966792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vmpublishing/slim-html-minify/?branch=master)

**WHAT**

PSR-15 html minify middleware with as low dependencies as possible.

This exists for two reasons:

- christianklisch/slim-minify did result in errors, as it just uses some regex.
- slim upgraded to version 4, thus changes its middleware interfaces to the PSR-15 type

**INSTALL**

To install simply use `composer require vmpublishing/slim-minify-minify:>=2.0.0`

**USE**

As this is basically just a wrapper for voku/html-min (  ), configure that to you liking and pass the instance in, ie:

```
$htmlMin = new HtmlMin();

$htmlMin->doOptimizeViaHtmlDomParser();               // optimize html via "HtmlDomParser()"
$htmlMin->doRemoveComments();                         // remove default HTML comments (depends on "doOptimizeViaHtmlDomParser(true)")
$htmlMin->doSumUpWhitespace();                        // sum-up extra whitespace from the Dom (depends on "doOptimizeViaHtmlDomParser(true)")
$htmlMin->doRemoveWhitespaceAroundTags();             // remove whitespace around tags (depends on "doOptimizeViaHtmlDomParser(true)")
$htmlMin->doOptimizeAttributes();                     // optimize html attributes (depends on "doOptimizeViaHtmlDomParser(true)")
$htmlMin->doRemoveHttpPrefixFromAttributes();         // remove optional "http:"-prefix from attributes (depends on "doOptimizeAttributes(true)")
$htmlMin->doRemoveDefaultAttributes();                // remove defaults (depends on "doOptimizeAttributes(true)" | disabled by default)
$htmlMin->doRemoveDeprecatedAnchorName();             // remove deprecated anchor-jump (depends on "doOptimizeAttributes(true)")
$htmlMin->doRemoveDeprecatedScriptCharsetAttribute(); // remove deprecated charset-attribute - the browser will use the charset from the HTTP-Header, anyway (depends on "doOptimizeAttributes(true)")
$htmlMin->doRemoveDeprecatedTypeFromScriptTag();      // remove deprecated script-mime-types (depends on "doOptimizeAttributes(true)")
$htmlMin->doRemoveDeprecatedTypeFromStylesheetLink(); // remove "type=text/css" for css links (depends on "doOptimizeAttributes(true)")
$htmlMin->doRemoveEmptyAttributes();                  // remove some empty attributes (depends on "doOptimizeAttributes(true)")
$htmlMin->doRemoveValueFromEmptyInput();              // remove 'value=""' from empty  (depends on "doOptimizeAttributes(true)")
$htmlMin->doSortCssClassNames();                      // sort css-class-names, for better gzip results (depends on "doOptimizeAttributes(true)")
$htmlMin->doSortHtmlAttributes();                     // sort html-attributes, for better gzip results (depends on "doOptimizeAttributes(true)")
$htmlMin->doRemoveSpacesBetweenTags();                // remove more (aggressive) spaces in the dom (disabled by default)

$middleware = new \VM\SlimHtmlMinify\Middlewares\HtmlMinify($htmlMin, true);

# and for slim
$app->add($middleware);

# or the lazy version depending on a container
$app->add(HtmlMinify::class);

# or just add it to specific routes / groups

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

4

Last Release

2524d ago

Major Versions

1.0.0 → 2.0.02019-06-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c7c5b7f1c2b1888e5aa95e413f688597838e52abe6d77e93e541ea268a27519?d=identicon)[verticalmedia](/maintainers/verticalmedia)

---

Top Contributors

[![scones](https://avatars.githubusercontent.com/u/472339?v=4)](https://github.com/scones "scones (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vmpublishing-slim-html-minify/health.svg)

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

###  Alternatives

[jaxon-php/jaxon-core

Jaxon is an open source PHP library for easily creating Ajax web applications

73142.3k25](/packages/jaxon-php-jaxon-core)[symfony/object-mapper

Provides a way to map an object to another object

34885.7k18](/packages/symfony-object-mapper)[los/basepath

PHP middleware to remove a path prefix from request uri

14132.4k](/packages/los-basepath)[hyperf/swoole-tracker

A swoole tracker library for Hyperf.

1720.3k](/packages/hyperf-swoole-tracker)[xefi/faker-php-laravel

Faker php integration with laravel

1915.1k](/packages/xefi-faker-php-laravel)[llm/mcp-server

PHP SDK for building MCP servers

431.1k](/packages/llm-mcp-server)

PHPackages © 2026

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