Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Javascript Minifier built in PHP
PHP JavaScript Shell
branch: master

Merge pull request #41 from tedious/empty_comments

Fix /**/ bug and add test cases.
latest commit 7575d9d96f
Robert Hafner tedivm authored

JShrink Build Status

License Latest Stable Version Coverage Status Total Downloads

JShrink is a php class that minifies javascript so that it can be delivered to the client quicker. This code can be used by any product looking to minify their javascript on the fly (although caching the results is suggested for performance reasons). Unlike many other products this is not a port into php but a native application, resulting in better performance.


Minifying your code is simple call to a static function-


// Basic (default) usage.
$minifiedCode = \JShrink\Minifier::minify($js);

// Disable YUI style comment preservation.
$minifiedCode = \JShrink\Minifier::minify($js, array('flaggedComments' => false));


  • Raw - 586,990
  • Gzip - 151,301
  • JShrink - 371,982
  • JShrink and Gzip - 93,507



Installing JShrink can be done through a variety of methods, although Composer is recommended.

"require": {
  "tedivm/jshrink": "~1.0"


Releases of JShrink are available on Github.


JShrink is licensed under the BSD License. See the LICENSE file for details.

In the spirit of open source, use of this library for evil is discouraged but not prohibited.

Something went wrong with that request. Please try again.