This extension adds Douglas Crockford's jsmin functionality to PHP.
This extension currently works with PHP 5.3.10+. Support for older verisons of PHP is not provided.
You can install this extension by using the
pecl install jsmin-beta
Note: Since this extension is currently in beta, you should provide the -beta suffix after the package name.
To install via source, clone this repo and then run the following:
$ cd /path/to/source $ phpize $ ./configure $ make install clean
Then, move the built module to your extensions directory.
For those on OSX, you can use Homebrew to manage PHP versions. Included is the jsmin extension.
Take a look at Homebrew PHP for installation notes.
Thanks to Jon Whitcraft for pushing the definition for jsmin to the project.
You will want to enable the extension in php.ini by adding:
Using jsmin is simple.
Example output is the following:
var notes="jsmin is easy!";
Returns error code of last call to jsmin().
Returns an error message (string) for the last call to jsmin().
- JSMIN_ERROR_NONE - No errors.
- JSMIN_ERROR_UNTERMINATED_STRING - Unterminated string.
- JSMIN_ERROR_UNTERMINATED_COMMENT - Unterminated comment.
- JSMIN_ERROR_UNTERMINATED_REGEX - Unterminated regex.
I decided to take the most recent source from Douglas Crockford's JSMin and port / manage the extension for PECL.