PHPackages                             doncadavona/html\_minifier - 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. doncadavona/html\_minifier

ActiveLibrary

doncadavona/html\_minifier
==========================

A PHP package to minify HTMLs, CSSs and Javascripts.

1133PHP

Since Jun 26Pushed 8y ago1 watchersCompare

[ Source](https://github.com/doncadavona/html_minifier)[ Packagist](https://packagist.org/packages/doncadavona/html_minifier)[ RSS](/packages/doncadavona-html-minifier/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

This is a work in Progress
==========================

[](#this-is-a-work-in-progress)

HTML Minifier
=============

[](#html-minifier)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8022ae3950d5fac4755e087e21600af92270211a54b99deaee3f753bbc358a6a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646f6e63616461766f6e612f68746d6c5f6d696e69666965722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/doncadavona/html_minifier)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/9cb1e403f98acb5b6484d376cc8a2ac963526804bf87cf7661d144c8bb16bff4/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f646f6e63616461766f6e612f68746d6c5f6d696e69666965722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/doncadavona/html_minifier)[![Coverage Status](https://camo.githubusercontent.com/1ab53cadff330febd8000033ba9cc0f7ac431400f2d1e9e062eb4b12087792dd/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f646f6e63616461766f6e612f68746d6c5f6d696e69666965722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/doncadavona/html_minifier/code-structure)[![Quality Score](https://camo.githubusercontent.com/19a615e76592dceb3c34ccc0262a219218f7fb62cf6d0b3fd0d810b167c36885/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f646f6e63616461766f6e612f68746d6c5f6d696e69666965722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/doncadavona/html_minifier)[![Total Downloads](https://camo.githubusercontent.com/bc584297b1ca5b3d6314d28b1ae748ee11ea33d7e4d5766d00fd3fc0c25934ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646f6e63616461766f6e612f68746d6c5f6d696e69666965722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/doncadavona/html_minifier)

A PHP package to minify HTMLs, Javascripts and CSSs. Supports [PSR-4](http://www.php-fig.org/psr/psr-4/) Autoloader.

Install
-------

[](#install)

Via Composer

```
$ composer require doncadavona/html_minifier
```

Usage
-----

[](#usage)

```
use DonCadavona\HtmlMinifier\HtmlMinifier;

// Sample HTML string
$html = '

	Document

		html {
			padding-top: 20px;
		}
		body {
			margin: 0px;
		}

	Hello World

		// This is single-line a comment.
		/* This is a
		multi-line
		comment. */
		/**
		 * This is a doc block comment.
		 */

';

// Minify the HTML
echo HtmlMinifier::minify($html);

// Document html { padding-top: 20px; } body { margin: 0px; } Hello World

// Minify the HTML and remove JavaScripts and CSSs:
echo HtmlMinifier::minify($html, true, true);

// DocumentHello World
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email `dcadavona@gmail.com` instead of using the issue tracker.

Credits
-------

[](#credits)

- [Oleg Gheorghita](https://github.com/smilemd) for his [yii2-htmlcompress](https://github.com/smilemd/yii2-htmlcompress) package.

License
-------

[](#license)

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

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor3

3 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b996d82173b13187a520b908a3d41a0376b6e3d6028061bcd55f8b85fceac276?d=identicon)[doncadavona](/maintainers/doncadavona)

---

Top Contributors

[![philsturgeon](https://avatars.githubusercontent.com/u/67381?v=4)](https://github.com/philsturgeon "philsturgeon (49 commits)")[![frankdejonge](https://avatars.githubusercontent.com/u/534693?v=4)](https://github.com/frankdejonge "frankdejonge (28 commits)")[![doncadavona](https://avatars.githubusercontent.com/u/8132015?v=4)](https://github.com/doncadavona "doncadavona (17 commits)")[![ravage84](https://avatars.githubusercontent.com/u/625761?v=4)](https://github.com/ravage84 "ravage84 (10 commits)")[![jotaelesalinas](https://avatars.githubusercontent.com/u/2042875?v=4)](https://github.com/jotaelesalinas "jotaelesalinas (8 commits)")[![RobLoach](https://avatars.githubusercontent.com/u/25086?v=4)](https://github.com/RobLoach "RobLoach (7 commits)")[![hansott](https://avatars.githubusercontent.com/u/3886384?v=4)](https://github.com/hansott "hansott (7 commits)")[![EmanueleMinotto](https://avatars.githubusercontent.com/u/417201?v=4)](https://github.com/EmanueleMinotto "EmanueleMinotto (5 commits)")[![reinink](https://avatars.githubusercontent.com/u/882133?v=4)](https://github.com/reinink "reinink (5 commits)")[![colinodell](https://avatars.githubusercontent.com/u/202034?v=4)](https://github.com/colinodell "colinodell (5 commits)")[![bcrowe](https://avatars.githubusercontent.com/u/752603?v=4)](https://github.com/bcrowe "bcrowe (5 commits)")[![marcqualie](https://avatars.githubusercontent.com/u/101022?v=4)](https://github.com/marcqualie "marcqualie (4 commits)")[![hassankhan](https://avatars.githubusercontent.com/u/1781985?v=4)](https://github.com/hassankhan "hassankhan (3 commits)")[![jclyons52](https://avatars.githubusercontent.com/u/6395559?v=4)](https://github.com/jclyons52 "jclyons52 (3 commits)")[![browner12](https://avatars.githubusercontent.com/u/5232313?v=4)](https://github.com/browner12 "browner12 (3 commits)")[![alexbilbie](https://avatars.githubusercontent.com/u/77991?v=4)](https://github.com/alexbilbie "alexbilbie (2 commits)")[![assertchris](https://avatars.githubusercontent.com/u/200609?v=4)](https://github.com/assertchris "assertchris (2 commits)")[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (2 commits)")[![dragoonis](https://avatars.githubusercontent.com/u/146321?v=4)](https://github.com/dragoonis "dragoonis (2 commits)")[![kdubuc](https://avatars.githubusercontent.com/u/895661?v=4)](https://github.com/kdubuc "kdubuc (2 commits)")

---

Tags

compressionhtmlminificationpackage

### Embed Badge

![Health badge](/badges/doncadavona-html-minifier/health.svg)

```
[![Health](https://phpackages.com/badges/doncadavona-html-minifier/health.svg)](https://phpackages.com/packages/doncadavona-html-minifier)
```

PHPackages © 2026

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