phpJSO - Javascript compression

phpJSO compresses JavaScript to just fractions of its original size. This helps cut load times on your web sites and reduce server stress, as well as save a LOT of disk space.

phpJSO can even be deployed to automatically compress a Javascript file whenever it is requested! If your server supports PHP you can download the phpJSO source and install it on your site.

phpJSO is completely free. Use it RIGHT NOW on our site, install it on yours, use it from your command line, make changes to it, do whatever you want. See our open source license.

Compress your Javascript!

You can use phpJSO and compress Javascript now on our site. You can also download the latest version (0.9): zip, gzip, bzip2.

How our Javascript compression works:

phpJSO is meant mainly to compress code, and it does this very well by removing comments and whitespace, as well as other unneeded tokens. It also uses advanced techniques to temporarily rename functions and variables - enough to reduce code size without harming the functionality of code libraries.

Any changes to phpJSO are carefully tested against a database of Javascript code. The only thing phpJSO has a trouble with is improper code that does not end lines with semicolons. However, we are working on a method to let you know when that code is found.

  1. Temporarily remove strings to preserve them
  2. Remove all comments
  3. Strip all tokens not required by Javascript
  4. Collapse math constants (1+1 becomes 2, etc)
  5. Put strings back in
  6. Optional: get every variable/function/word and temporarily give them shorter names. These are decompressed to their full names by the browser.

For more information, see an example of compressed javascript and the detailed phpJSO documentation. phpJSO works on all modern browsers, and a few older ones too.