Is there anything like Minify for PHP scripts?

scripts
by Kmeron

Question by Andrew U: Is there anything like Minify for PHP scripts?
It’s great for shortening/optimizing javascript, but how about shortening/optimizing php scripts? Is there anything out there like it for php scripts?

Best answer:

Answer by flybishop
Yes and no.

There’s a product called Zend Guard by the makers of Zend, which is the engine that executes the scripts written in PHP. It’s really meant for people who want to sell their application because it obfuscates their code so it can’t be reverse engineered. Then this script needs to be run through the Zend Optimizer in order to executed the encoded files. It’s supposed to make it faster but I’ve never tried it because, one, it’s not free, and two, I’ve never needed to use it.

But the Zend engine is already extremely optimized to execute PHP code as fast as possible so it’s not necessary to go any further. Also, the reason to minify your js code is to shrink it so that it’s a smaller download, which saves bandwidth, and so that your page renders a bit faster. However since PHP is executed on the server before being output it makes shrinking unnecessary.

Add your own answer in the comments!

Get the book now