PHPackages                             mrclay/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. mrclay/minify

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

mrclay/minify
=============

Minify is a PHP app that helps you follow several rules for client-side performance. It combines multiple CSS or Javascript files, removes unnecessary whitespace and comments, and serves them with gzip encoding and optimal client-side cache headers

4.0.2(3mo ago)3.0k17.8M—0.2%468[58 issues](https://github.com/mrclay/minify/issues)20BSD-3-ClausePHPPHP ^8.1CI passing

Since Jul 20Pushed 3mo ago144 watchersCompare

[ Source](https://github.com/mrclay/minify)[ Packagist](https://packagist.org/packages/mrclay/minify)[ Docs](https://github.com/mrclay/minify)[ RSS](/packages/mrclay-minify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (30)Used By (20)

Minify is no longer regularly maintained
----------------------------------------

[](#minify-is-no-longer-regularly-maintained)

The original authors no longer recommend using Minify, especially previous versions, which were not designed to handle modern JS and CSS syntax. Instead, use an up-to-date performance measurement tool like [Lighthouse](https://developer.chrome.com/docs/lighthouse/overview) and follow its recommendations.

In 2010, Minify offered a fine improvement for some websites, but browsers and HTTP servers are now much better, and Minify may offer only a marginal performance benefit in narrow cases. Also both JS and CSS now change rapidly, and new syntaxes are likely to lead to broken code being served through Minify.

About
-----

[](#about)

Minify is an HTTP server for JS and CSS assets. It compresses and combines files and serves it with appropriate headers, allowing conditional GET or long-Expires.

*Before*[![7 requests](https://camo.githubusercontent.com/15daabdd2cfd2aa9bceb73e11cf9ef628994c49418e25ed7f16e3de312621155/687474703a2f2f6d72636c61792e6f72672f77702d636f6e74656e742f75706c6f6164732f323030382f30392f666964646c65725f6265666f72652e706e67)](https://camo.githubusercontent.com/15daabdd2cfd2aa9bceb73e11cf9ef628994c49418e25ed7f16e3de312621155/687474703a2f2f6d72636c61792e6f72672f77702d636f6e74656e742f75706c6f6164732f323030382f30392f666964646c65725f6265666f72652e706e67)*After*[![2 requests](https://camo.githubusercontent.com/b9c1aa5259ec2986b36f0abaada3829c1ac4de705616121576260aca25646cfa/687474703a2f2f6d72636c61792e6f72672f77702d636f6e74656e742f75706c6f6164732f323030382f30392f666964646c65725f61667465722e706e67)](https://camo.githubusercontent.com/b9c1aa5259ec2986b36f0abaada3829c1ac4de705616121576260aca25646cfa/687474703a2f2f6d72636c61792e6f72672f77702d636f6e74656e742f75706c6f6164732f323030382f30392f666964646c65725f61667465722e706e67)The stats above are from a [brief walkthrough](http://mrclay.org/index.php/2008/09/19/minify-21-on-mrclayorg/) which shows how easy it is to set up Minify on an existing site. It eliminated 5 HTTP requests and reduced JS/CSS bandwidth by 70%.

Relative URLs in CSS files are rewritten to compensate for being served from a different directory.

Static file serving
-------------------

[](#static-file-serving)

Version 3 allows [serving files directly from the filesystem](static/README.md) for much better performance. We encourage you to try this feature.

Support
-------

[](#support)

Post to the [Google Group](http://groups.google.com/group/minify).

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

[](#installation)

See the [install guide](docs/Install.wiki.md).

Configuration &amp; Usage
-------------------------

[](#configuration--usage)

(Using 2.x? [Here are the 2.x docs](https://github.com/mrclay/minify/tree/2.x/docs).)

See the [user guide](docs/UserGuide.wiki.md).

Minify also comes with a [URI Builder application](docs/BuilderApp.wiki.md) that can help you write URLs for use with Minify or configure groups of files.

See the [cookbook](docs/CookBook.wiki.md) for more advanced options for minification.

More [docs are available](docs).

Unit Testing
------------

[](#unit-testing)

1. Install dev deps via Composer: `composer install`
2. `composer test` or `phpunit`

Warnings
--------

[](#warnings)

- Minify is designed for efficiency, but, for very high traffic sites, it will probably serve files slower than your HTTPd due to the CGI overhead of PHP. See the [FAQ](docs/FAQ.wiki.md#how-fast-is-it) and [CookBook](docs/CookBook.wiki.md) for more info.
- If you combine a lot of CSS, watch out for [IE's 4096 selectors-per-file limit](http://stackoverflow.com/a/9906889/3779), affects IE 6 through 9.
- Minify *should* work fine with files encoded in UTF-8 or other 8-bit encodings like ISO 8859/Windows-1252. By default Minify appends ";charset=utf-8" to the Content-Type headers it sends.

Acknowledgments
---------------

[](#acknowledgments)

Minify was inspired by [jscsscomp](http://code.google.com/p/jscsscomp/) by Maxim Martynyuk and by the article [Supercharged JavaScript](http://www.hunlock.com/blogs/Supercharged_Javascript) by Patrick Hunlock.

The [JSMin library](http://www.crockford.com/javascript/jsmin.html) used for JavaScript minification was originally written by Douglas Crockford and was [ported to PHP](https://github.com/mrclay/jsmin-php) by Ryan Grove specifically for use in Minify.

###  Health Score

76

—

ExcellentBetter than 100% of packages

Maintenance82

Actively maintained with recent releases

Popularity76

Solid adoption and visibility

Community54

Growing community involvement

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 59.1% 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 ~183 days

Recently: every ~307 days

Total

26

Last Release

92d ago

Major Versions

2.3.1 → 3.0.02017-04-03

2.3.2 → 3.0.12017-06-08

2.3.3 → 3.0.52019-10-01

3.0.14 → 4.0.02024-01-04

PHP version history (4 changes)2.1.6PHP &gt;=5.2.1

3.0.0PHP ^5.3.0 || ^7.0

3.0.11PHP ^5.3.0 || ^7.0 || ^8.0

4.0.0PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![mrclay](https://avatars.githubusercontent.com/u/170687?v=4)](https://github.com/mrclay "mrclay (456 commits)")[![glensc](https://avatars.githubusercontent.com/u/199095?v=4)](https://github.com/glensc "glensc (247 commits)")[![rgrove](https://avatars.githubusercontent.com/u/1465?v=4)](https://github.com/rgrove "rgrove (19 commits)")[![demidovsky](https://avatars.githubusercontent.com/u/5030645?v=4)](https://github.com/demidovsky "demidovsky (4 commits)")[![tubalmartin](https://avatars.githubusercontent.com/u/522838?v=4)](https://github.com/tubalmartin "tubalmartin (4 commits)")[![jasonvarga](https://avatars.githubusercontent.com/u/105211?v=4)](https://github.com/jasonvarga "jasonvarga (3 commits)")[![joec4i](https://avatars.githubusercontent.com/u/357672?v=4)](https://github.com/joec4i "joec4i (3 commits)")[![joscha](https://avatars.githubusercontent.com/u/188038?v=4)](https://github.com/joscha "joscha (3 commits)")[![panvid](https://avatars.githubusercontent.com/u/10072693?v=4)](https://github.com/panvid "panvid (2 commits)")[![Be-Mann](https://avatars.githubusercontent.com/u/25839760?v=4)](https://github.com/Be-Mann "Be-Mann (2 commits)")[![benface](https://avatars.githubusercontent.com/u/1059139?v=4)](https://github.com/benface "benface (2 commits)")[![KTOmega](https://avatars.githubusercontent.com/u/2063153?v=4)](https://github.com/KTOmega "KTOmega (2 commits)")[![meven](https://avatars.githubusercontent.com/u/620941?v=4)](https://github.com/meven "meven (2 commits)")[![acidvertigo](https://avatars.githubusercontent.com/u/809397?v=4)](https://github.com/acidvertigo "acidvertigo (2 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (2 commits)")[![robations](https://avatars.githubusercontent.com/u/205320?v=4)](https://github.com/robations "robations (2 commits)")[![SimonSimCity](https://avatars.githubusercontent.com/u/392589?v=4)](https://github.com/SimonSimCity "SimonSimCity (2 commits)")[![thirsch](https://avatars.githubusercontent.com/u/1055937?v=4)](https://github.com/thirsch "thirsch (2 commits)")[![venkatraj](https://avatars.githubusercontent.com/u/1931924?v=4)](https://github.com/venkatraj "venkatraj (1 commits)")[![adambalint-srg](https://avatars.githubusercontent.com/u/548582?v=4)](https://github.com/adambalint-srg "adambalint-srg (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mrclay-minify/health.svg)

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

###  Alternatives

[google/cloud-core

Google Cloud PHP shared dependency, providing functionality useful to all components.

343121.4M79](/packages/google-cloud-core)[wa72/html-pretty-min

HTML minifier and indenter that works on the DOM tree

22219.4k8](/packages/wa72-html-pretty-min)[uspdev/replicado

Classes PHP que consome dados do Replicado USP

136.2k7](/packages/uspdev-replicado)

PHPackages © 2026

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