patchwork/jsqueeze
PHP JavaScript minifier that removes whitespace/comments, mangles local vars, and preserves important/conditional comments. Works on semicolon-free, parse-error-free JS; compression comparable to YUI Compressor/UglifyJS. Single class, Composer install.
JSqueeze shrinks / compresses / minifies / mangles Javascript code.
It's a single PHP class that has been developed, maintained and thoroughly tested since 2003 on major JavaScript frameworks (e.g. jQuery).
JSqueeze operates on any parse error free JavaScript code, even when semi-colons are missing.
In term of compression ratio, it compares to YUI Compressor and UglifyJS.
Through composer:
{
"require": {
"patchwork/jsqueeze": "~2.0"
}
}
use Patchwork\JSqueeze;
$jz = new JSqueeze();
$minifiedJs = $jz->squeeze(
$fatJs,
true, // $singleLine
true, // $keepImportantComments
false // $specialVarRx
);
$ or with a single _.with/eval then be careful.false/true by !1/!0new Array/Object by []/{}var declarations with commas/*!...;;; like single-line comments.This library is free software; you can redistribute it and/or modify it under the terms of the (at your option): Apache License v2.0 (see provided LICENCE.ASL20 file), or GNU General Public License v2.0 (see provided LICENCE.GPLv2 file).
How can I help you explore Laravel packages today?