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:

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.

Comments (33)

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.

  • Comment by: Steve Clay
  • Posted:

Looking forward to v3.0. Many people pass js files through custom_rhino before using packer. rhino makes JavaScript code more well formed and ensures that the packed code works. rhino already shortens variable and argument names. Maybe the new version of packer can take advantages of custom_rhino.

  • Comment by: Arrix
  • Posted:

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 ?

  • Comment by: Nao
  • Posted:

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:

@alerxander – thanks for the aptana plugin! I’ve added it to the download page.

  • Comment by: -dean
  • Posted:

Nao, here is another javascript compressor. It compresses several kB better and seems to compress prototype.js ok without any changes made to it. No javascript errors popup after it is compressed.

  • Comment by: Rocket
  • Posted:

The above compressor tool has been updated and moved to a new adress:

  • Comment by: wildcard
  • Posted:

Hi all-

I made a version of the above script for php4.

[...] A la base disponible en javascript sur le site de Dean Edwards, qui, on peut le dire est l’inspirateur du framework Prototype, cet outil a été developpé en plusieurs autre languages: .NET, python, Perl et meme en Ruby. bizarrement, aussi en WSH (une sorte de javascript en ligne de commande pour window) [...]

@Mark – Thanks for the PHP4 conversion. I’ll add it to the download page later.

  • Comment by: -dean
  • Posted:

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.

  • Comment by: JoeSchmoe
  • Posted:

[...] Further reading: On a quest for ultimate website performance Yahoo! Developer Faster Page Loads – Bundle Your CSS and Javascript CSS shorthand Web Site Optimization PHP Packer Clean CSS Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages. [...]

Please give me some directions how to install Obfuscator in Aptana… Do I have to implement it as a Script?

  • Comment by: thehellion
  • Posted:

[...] 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 [...]

[...] [...]

  • Pingback by: Anonymous
  • Posted:

is this pkg/script still pertinent @ PHP 5.3x / 5.4? tia,

  • Comment by: Greg
  • Posted:

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

  • Comment by: Nguyen from vietnam
  • Posted:

Is there a mirror of the rhino port? It now redirects to a loony site.

  • Comment by: Anonymous
  • Posted:

Just about all penis stretcher devices currently available are just about all built on a single principle. By extending the manhood gently on the set time period, the penises cells is going to be stimulated and can encourage development in both girth and length.

yo we da realist best be recognize

Hi there.. Glad to know this website. Thanks for this information..

Stop by several home business enterprise blogs everyday from the search engine optimization like the search engines, yahoo or maybe bing, read the modern post, and generate a comment concerning this. Make guaranteed your thoughts is depend on their blog rather than just an ad on your business. How you’ll end up getting more targeted visitors? Leave your site or website from the comment You won’t need to believe this traffic you will get using that simple principle. Commenting with other home business enterprise blogs is simple and easy.

As i say When i tried each of the not suitable strategies to make money on-line, I indicate it. Used to do the blog site with Adsense, tried using Click Traditional bank with a digital info ebooks, Amazon’s internet, and a good many others. I assume given that others were being prospering on doing acquiring results it would be straightforward for me to help copy. I generally knew When i needed this adaptability and standard of living that the web based business have the capacity to provide although I seemed to be still earning a living for others.

Why people love franchising towards franchisor usually are that franchisee should buy license on the franchisor running the team. To invest in this permission, the franchisee pays great amount towards franchisor, in addition to besides that, pays some sort of monthly impose for trying to keep that label. Moreover, a franchised small business can grow much quicker than should the owner could well be responsible to help finance each of the outlets. Likewise, the process could well be cumbersome.

With Network marketing, there is enable you to make dollars with a ton of money upfront. A sensational scene to employ a huge capital as a way to begin. The key is usually to build some sort of complex of people (which you can apply efficiently when you go online) in addition to sell the products. If they register for you, you can be paid because of the company. On this system, it is important to get a very beneficial skill with marketing just to be successful.

Include your medical history ready when getting a life insurance policy, because delaying generally is a hassle for you. You are aware that they may request your medical history, and except you’ve kept on top of it by yourself, the hospital’s files system might take weeks or maybe months for getting it to your account.

Also, in improvement to packages insuranc insurance policy coverage, there are definitely more covers available that you simply seriously contemplate when choosing a motor pick up truck cargo insurance cover. Refrigerator brake pedal down, acquired freight insurance policies, loading in addition to unloading insurance policy coverage, and fraud coverage undoubtedly are a few to bring up. However, it is your choice whether to feature these added optional coverage on your truck cargo insurance cover for a compact portion connected with additional advanced. Anyway, it is advisable to make the selection carefully as a way to maximize ones scope connected with cover.

This is good stuff for sure, bookmarked this post to make sure I won’t forget ;)

  • Comment by: David Porter
  • Posted:

packer to php is not that easy to understand, I might have to read these instructions twice to full comprehend the meaning of it.

  • Comment by: Phillip Mason
  • Posted:

Leave A Comment

Line and paragraph breaks automatic, email address never displayed. Some HTML allowed.