PHPackages                             innoweb/silverstripe-minify-html - 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. innoweb/silverstripe-minify-html

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

innoweb/silverstripe-minify-html
================================

Minifies the HTML output for all frontend requets using a middleware.

3.1.0(1mo ago)27.2k21BSD-3-ClausePHP

Since Dec 11Pushed 1mo ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (12)Used By (1)

Silverstripe Minify HTML
========================

[](#silverstripe-minify-html)

[![Version](https://camo.githubusercontent.com/7dafd3f216fa38829587a4718464b43d632040439f2453a3ae6c3603a025aa4e/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e6e6f7765622f73696c7665727374726970652d6d696e6966792d68746d6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/innoweb/silverstripe-minify-html)[![License](https://camo.githubusercontent.com/36fa6b727a3c5429cc098ed215ac830438cb682cd3ebeb27dafea2bee787cc83/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696e6e6f7765622f73696c7665727374726970652d6d696e6966792d68746d6c2e7376673f7374796c653d666c61742d737175617265)](license.md)

Overview
--------

[](#overview)

Minifies the HTML output for all frontend requets using a middleware wrapping [voku's HTML Compressor and Minifier for PHP](https://packagist.org/packages/voku/html-min).

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

[](#requirements)

- Silverstripe CMS 6.x
- [voku/html-min 4 || 5](https://packagist.org/packages/voku/html-min)

Note: this version is compatible with SilverStripe 6. For SilverStripe 5, please see the [2 release line](https://github.com/xini/silverstripe-minify-html/tree/2).

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

[](#installation)

Install the module using composer:

```
composer require innoweb/silverstripe-minify-html dev-master

```

Then run dev/build.

Enabling minification
---------------------

[](#enabling-minification)

Once installed, HTML minification is enabled by default.

See the example configuration in `config/envtoggle.yml.example` for how to toggle minification on/off for your environment via a `.env` variable.

In the example, a `.env` variable named `HTML_MINIFICATION_ENABLED` can be added, which will enable/disable minification based on whether the value is true or false/absent.

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

[](#configuration)

The config variables are derived from voku's library and adjusted to work with Silverstripe. The following config values are available:

```
Innoweb\MinifyHTML\Util\HTMLMinifier:

  // Disable all optimisations, e.g. for dev environment
  enable_minification: true

  // optimize html via voku's "HtmlDomParser()"
  optimize_via_html_dom_parser: true

  // remove default HTML comments
  // (depends on optimize_via_html_dom_parser: true)
  // (disabled by default)
  remove_comments: false

  // sum-up extra whitespace from the Dom
  // (depends on optimize_via_html_dom_parser: true)
  sum_up_whitespace: true

  // remove whitespace around tags
  // (depends on optimize_via_html_dom_parser: true)
  remove_whitespace_around_tags: true

  // optimize html attributes
  // (depends on optimize_via_html_dom_parser: true)
  optimize_attributes: true

  // remove optional "http:"-prefix from attributes
  // (depends on optimize_via_html_dom_parser: true)
  // (disabled by default)
  remove_http_prefix_from_attributes: false

  // remove optional "https:"-prefix from attributes
  // (depends on optimize_via_html_dom_parser: true)
  // (disabled by default)
  remove_https_prefix_from_attributes: false

  // remove defaults
  // (depends on optimize_via_html_dom_parser: true)
  // (disabled by default)
  remove_default_attributes: false

  // remove deprecated anchor-jump
  // (depends on optimize_via_html_dom_parser: true)
  // (disabled by default)
  remove_deprecated_anchor_name: false

  // remove deprecated charset-attribute - the browser will use the charset from the HTTP-Header, anyway
  // (disabled by default)
  remove_deprecated_script_charset_attribute: false

  // remove deprecated script-mime-types
  remove_deprecated_type_from_script_tag: true

  // remove "type=text/css" for css links
  remove_deprecated_type_from_stylesheet_link: true

  // remove "media="all" from all links and styles
  // (disabled by default)
  remove_default_media_type_from_style_and_link_tag: false

  // remove type="submit" from button tags
  // (disabled by default)
  remove_default_type_from_button: false

  // remove some empty attributes
  // (depends on optimize_via_html_dom_parser: true)
  remove_empty_attributes: true

  // remove 'value=""' from empty
  // (depends on optimize_via_html_dom_parser: true)
  remove_value_from_empty_input: true

  // sort css-class-names, for better gzip results
  // (depends on optimize_via_html_dom_parser: true)
  sort_css_class_names: true

  // sort html-attributes, for better gzip results
  // (depends on optimize_via_html_dom_parser: true)
  sort_html_attributes: true

  // remove more (aggressive) spaces in the dom
  // (disabled by default)
  remove_spaces_between_tags: false

  // remove quotes e.g. class="lall" => class=lall
  // (disabled by default)
  remove_omitted_quotes: false

  // remove ommitted html tags e.g. lall => lall
  // (disabled by default)
  remove_omitted_html_tags: false

```

License
-------

[](#license)

BSD 3-Clause License, see [License](license.md)

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance88

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 78.6% 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 ~197 days

Recently: every ~286 days

Total

11

Last Release

59d ago

Major Versions

1.x-dev → 2.0.02023-03-16

2.x-dev → 3.0.02025-09-18

### Community

Maintainers

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

---

Top Contributors

[![xini](https://avatars.githubusercontent.com/u/1152403?v=4)](https://github.com/xini "xini (11 commits)")[![dizzystuff](https://avatars.githubusercontent.com/u/576903?v=4)](https://github.com/dizzystuff "dizzystuff (2 commits)")[![elkebe](https://avatars.githubusercontent.com/u/31311851?v=4)](https://github.com/elkebe "elkebe (1 commits)")

---

Tags

performancesilverstripeminifyhmtl

### Embed Badge

![Health badge](/badges/innoweb-silverstripe-minify-html/health.svg)

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

###  Alternatives

[silverstripe/userforms

UserForms enables CMS users to create dynamic forms via a drag and drop interface and without getting involved in any PHP code

1371.1M85](/packages/silverstripe-userforms)[symbiote/silverstripe-advancedworkflow

Adds configurable workflow support to the CMS, with a GUI for creating custom workflow definitions.

46302.4k9](/packages/symbiote-silverstripe-advancedworkflow)[silverstripe/sharedraftcontent

Share draft page content with non-CMS users

21424.1k12](/packages/silverstripe-sharedraftcontent)[nathancox/minify

Minifies CSS requirements using Minify (http://code.google.com/p/minify/)

26151.0k1](/packages/nathancox-minify)[dorsetdigital/silverstripe-enhanced-requirements

Enhanced requirements for Silverstripe

118.4k4](/packages/dorsetdigital-silverstripe-enhanced-requirements)[axllent/silverstripe-cms-tweaks

Several CMS usability improvements

1726.4k1](/packages/axllent-silverstripe-cms-tweaks)

PHPackages © 2026

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