PHPackages                             dbx123/php-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dbx123/php-minifier

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

dbx123/php-minifier
===================

A PHP minifier for HTML, CSS and JS files.

1.0.1(7y ago)11.9k[1 issues](https://github.com/dbx123/php-minifier/issues)BSDPHPPHP &gt;=5.3.0

Since May 22Pushed 7y agoCompare

[ Source](https://github.com/dbx123/php-minifier)[ Packagist](https://packagist.org/packages/dbx123/php-minifier)[ Docs](https://github.com/dbx123/php-minifier)[ RSS](/packages/dbx123-php-minifier/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

phpmin-php-minifier
===================

[](#phpmin-php-minifier)

PHPMin is an inline PHP minifier for web resources. It lets you minify HTML4, HTML5, XHTML, CSS and JavaScript files in a single line of code.

The best bit is its free and open source under the BSD license.

Installing PHPMin
-----------------

[](#installing-phpmin)

Installing PHPMin should only take a minute. Here are your choices:

- Install via composer `composer require -dev dbx123/php-minifier`
- Hit the 'Download Zip' button on GitHub.

You can include all the necessary classes by simply including the php-minifier/phpmin.php file.

```
require_once ("php-minifier/phpmin.php");
```

Using PHPMin
------------

[](#using-phpmin)

How to compress HTML:

```
$minified_html = PHPMin\Minify::html($any_html);
```

This automatically compresses all inline scripts and stylesheets within the HTML document. Apply a 'data-no-min' attribute to a script or style in your HTML markup to exclude it from minification.

How to compress CSS:

```
$minified_css = PHPMin\Minify::css($any_css);
```

How to compress JS:

```
$minified_js = PHPMin\Minify::js($any_js);
```

Spelling out out:

```
require_once ("php-minifier/phpmin.php");

$html = file_get_contents("http://en.wikipedia.org/wiki/Minification_%28programming%29");
$minified_html = PHPMin\Minify::html($html);
// a 9.38% performance boost - in 3 lines of code!!
```

There are working examples in the /examples folder of the package.

PHPMin Performance
------------------

[](#phpmin-performance)

- The compression ratio are typically 5-20% for HTML
- The compression ratio are typically 5-30% for CSS
- The compression ratio are typically 5-30% for JavaScript

Even highly optimized sites such as wikipedia.com, github.com and W3Schools.com could reduce the size of their HTML payload using PHPMin html compression.

Who Made PHPMin ?
-----------------

[](#who-made-phpmin-)

The PHPMin project is currently maintained by David Boyle The Css compressor is built upon the CssMin package by Joe Scylla. Some code also contributed by Rowan Beentje The JavaScript compressor is built upon Douglas Crockford's JSMin.

PHPMin Purpose
--------------

[](#phpmin-purpose)

PHPMin is here to reduce filesizes and page load times, parse css

PHPMin Improvements
-------------------

[](#phpmin-improvements)

- We are relatively new to Composer - and welcome input on package improvements.
- Removing default values from html tags should reduce HTML file size
- Allowing HTML fragments rather than whole documents would be ideal.

Unit Test Examples
------------------

[](#unit-test-examples)

./vendor/bin/phpunit --configuration phpunit.xml

./vendor/bin/phpunit --configuration phpunit.xml --coverage-html coverage-report

./vendor/bin/phpunit --configuration phpunit.xml test/CssMin/CssMinTest.php --coverage-html coverage-report

./vendor/bin/phpunit --configuration phpunit.xml --filter testCssConvertLevel3AtKeyframesMinifierFilterMinification --coverage-html coverage-report

./vendor/squizlabs/php\_codesniffer/bin/phpcs --standard=PSR2 src

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

2918d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/146e5cd0746b5aea1194af2072c6e7b744919aa90937fed602616bcaaa38d15a?d=identicon)[david.boyle](/maintainers/david.boyle)

---

Top Contributors

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

---

Tags

phpjavascriptcssJShtmlHTML5minifycompressphp5freeCSS3open-sourceminphpmin

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/dbx123-php-minifier/health.svg)

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

###  Alternatives

[matthiasmullie/minify

CSS &amp; JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.

2.0k30.5M336](/packages/matthiasmullie-minify)[stolz/assets

An ultra-simple-to-use assets management library

296519.2k8](/packages/stolz-assets)[sensiolabs/minify-bundle

Assets Minifier (CSS, JS) for Symfony &amp; Minify integration in Asset Mapper

5694.9k1](/packages/sensiolabs-minify-bundle)[nlac/nlsclientscript

Yii ClientScript extension for prevent reloading javascript and merging/minfying resources

208.2k](/packages/nlac-nlsclientscript)

PHPackages © 2026

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