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(7y ago)2213[1 issues](https://github.com/vmpublishing/slim-html-minify/issues)MITPHP

Since May 27Pushed 7y 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 2w ago

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

27

—

LowBetter than 47% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

2572d ago

Major Versions

1.0.0 → 2.0.02019-06-14

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1516466?v=4)[verticalmedia](/maintainers/verticalmedia)[@verticalmedia](https://github.com/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

[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k447.1M9.1k](/packages/symfony-dependency-injection)[cakephp/cakephp

The CakePHP framework

8.8k19.1M1.7k](/packages/cakephp-cakephp)[illuminate/container

The Illuminate Container package.

31180.7M2.3k](/packages/illuminate-container)[symfony/type-info

Extracts PHP types information.

20062.9M227](/packages/symfony-type-info)[mcp/sdk

Model Context Protocol SDK for Client and Server applications in PHP

1.5k937.5k70](/packages/mcp-sdk)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

562565.8k42](/packages/ecotone-ecotone)

PHPackages © 2026

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