Skip to content
Combines. minifies, and serves CSS or Javascript files
PHP CSS JavaScript HTML Shell
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
builder Merge branch '2.x' Jun 27, 2016
docs cleanup 3.x branch leftover Jun 8, 2017
lib Bugfix for option sanitizer Oct 28, 2019
min_extras Improve Minify_Lines algorithm and add tests May 19, 2016
tests Fix unit test for bd7d107 Oct 1, 2019
.gitattributes Port last of min_unit_tests, remove references to it, add composer sc… Nov 22, 2015
.gitignore Merge branch 'master' into static Jan 19, 2017
.htaccess Collapse "min" into project root and get unit tests working. Sep 28, 2015
.php_cs phpcs: enable psr2 Oct 16, 2016
.travis.yml travis: add php 7.3, 7.4, 8.0; remove hhvm Oct 1, 2019 Update changelog for 3.0.6 Oct 28, 2019
LICENSE.txt moved unit_tests to min_unit_tests Sep 11, 2008
UPGRADING.txt Port last of min_unit_tests, remove references to it, add composer sc… Nov 22, 2015
bootstrap.php Composer compatibility - check if library is inside the vendor dir Mar 27, 2017
composer.json Force lesserphp to v0.5.2 because v0.5.3 changed namespace Dec 31, 2019
example.index.php Improves README and add install doc page Apr 2, 2016
groupsConfig.php Large restructuring Mar 10, 2016
index.php Large restructuring Mar 10, 2016
quick-test.js Improves README and add install doc page Apr 2, 2016
quick-testinc.less Improves README and add install doc page Apr 2, 2016
server-info.php Merge branch '2.x' Mar 13, 2017
utils.php Large restructuring Mar 10, 2016

Welcome to Minify!

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
After 2 requests

The stats above are from a brief walkthrough 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

Version 3 allows serving files directly from the filesystem for much better performance. We encourage you to try this feature.


Post to the Google Group.


See the install guide.

Configuration & Usage

(Using 2.x? Here are the 2.x docs.)

See the user guide.

Minify also comes with a URI Builder application that can help you write URLs for use with Minify or configure groups of files.

See the cookbook for more advanced options for minification.

More docs are available.

Unit Testing

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


  • 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 and CookBook for more info.
  • If you combine a lot of CSS, watch out for IE's 4096 selectors-per-file limit, 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.


Minify was inspired by jscsscomp by Maxim Martynyuk and by the article Supercharged JavaScript by Patrick Hunlock.

The JSMin library used for JavaScript minification was originally written by Douglas Crockford and was ported to PHP by Ryan Grove specifically for use in Minify.

You can’t perform that action at this time.