Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript minification and shrinking variables with PHP

I've been looking around SO for a JavaScript obfuscation script of some kind, note that I'm not looking for a compressor, I need an obfuscation script/code that will shrink the JavaScript files I have in PHP (not in JavaScript) for production reasons.

I've heard about Minify, I've used it a couple times, works great but it doesn't obfuscate my JS code, simply that is all I need to have, think like the Dean Edwards packer but without packing it, just the shrink variables mode in PHP instead of JS.

EDIT: My mistake, I understood "obfuscate" wrongly, I mean minification on the JS code - shrinking variable names and removing whitespace, etc. Minify is the closest I got to, but it does not shrink variables.

Is there one out there?

like image 778
MacMac Avatar asked Jun 19 '26 18:06

MacMac


1 Answers

exec('java.exe -jar compiler.jar --js pre.js --manage_closure_dependencies true --js_output_file end.js');

exec('java.exe -jar yuicompressor.jar pre.js  -o end.js');

use:

google closure compiler AND http://developer.yahoo.com/yui/compressor/

like image 138
user956584 Avatar answered Jun 21 '26 07:06

user956584



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!