A Perfect Port of Packer to PHP
And Peter Piper picked a peck of pickled peppers.
Another port of packer. This time a PHP version by Nicolas Martin:
So far a version of packer exists in the following languages:
- A version in perl by Rob Seiler
- A version in python (not sure this works)
- A .NET conversion by Jesse Hansen
- This new PHP version
- Dan Webb works on a conversion to ruby
- And I’m working on version 3.0 which is written using Base. This version includes the facility to shorten variable and argument names for true obfuscation and better compression.
The download page contains links to all of the above versions.
There is also this web service thing to try. And this Rhino port might be interesting to some.
Leave a comment
Good stuff. Just FYI, in a pinch, Troels Jakobsen’s Bookmarklet Builder does a bang-up job of “unpacking” minimized JS pretty well, though it’s not as reliable for minimization.
What a coincidence! I just did a same port of the packer in PHP a few weeks ago.
prototype.js don’t work after be packed.
Someone find a way to pack it ?
Nao, you have to ensure semi-colons are present in a lot of areas. I usually visually scan it look for areas to add them, then use Firebug to debug and figure out where the ones I missed are.
no port, but apatana integration of packer: http://pfirsichmelba.de/d.edwards_packer2aptana.zip
@alerxander – thanks for the aptana plugin! I’ve added it to the download page.
The above compressor tool has been updated and moved to a new adress: http://www.bananascript.com/
I made a version of the above script for php4.
@Mark – Thanks for the PHP4 conversion. I’ll add it to the download page later.
Verry good job, I “had” lot of big js files. Thank you for this stuff !
Both PHP versions suffer from an old bug: if you have INSIDE a string something that starts with a $, that will be trimmed like if that were a variable.
Ex: var $var = “$this should not be changed!!”;
After compression: v = “t should not be changed!!”;
I think i reported this to Dean a long time ago, and the js version works as intended. I don´t know why the php version doesn´t, since i can see the regular expressions used to protect the strings…
We attempted to implement this PHP JS packer into a product we are building. While the packer works perfectly in our development systems, the second we pushed it into production it totally choked. Be advised that if you plan to use this in a high traffic environment, you would be wise to stress test it before exposing it to high volumes of on-the-fly packing.
Please give me some directions how to install Obfuscator in Aptana… Do I have to implement it as a Script?
[…] este post comparo a Closure con las herramientas de compresión mas conocidas, YUI, Packer de Dean Edward y Shrinksafe the Dojo compressor comprimiendo tres importantes frameworks para […]
[…] http://dean.edwards.name/weblog/2006/12/packer-php/ […]
is this pkg/script still pertinent @ PHP 5.3x / 5.4? tia,
He gives every thing to the world for free, even the About script, so people can use or port it to several languages. I would nominate Dean Edward for the next Nobel Prize, in caterogy: Peace
Comments are closed.