Approximate time to read: 3 minutes
Now, there’s not a lot of documentation on what exactly it does, just how to use it. However, PHP Speedy is based on a number of utilities that the author had been working on, so his blog comments on those can give us a clue.
Here are the options in more detail…
What we do know is that it reduces your code size by removing redundant code. I contacted the author of PHP Speedy, Leon Chevalier, and he confirmed more of the detail. For CSS files whitespace and comments are removed. For code all leading spaces, tabs and carriage returns NOT preceded by a PHP close tag are removed.
I’m sure this could be more robust – for example why not remove tabs and carriage returns for CSS – but is probably nearly as good as minifying your code beforehand.
So, the big question is, does minifying your code before using PHP Speedy make a difference? Well, I ran one of my sites CSS through the online compressor at CSSdrive – this reduced it by 25%. However, according to Yslow, it made little, or no, difference in speed. The conclusion must therefore be that any compression before using PHP Speedy is a waste of time. This will save a lot of effort long term.
Far Future Expires
Now, this is the bit I’ve always been afraid of. If used manually, you have to remember to provide files with different filenames whenever they change. Otherwise the previous cached version will be used.
What does this mean? If you haven’t changed any of the JS or CSS files, then it will be cached at the users end.
PHP Speedy is an incredibly well thought out and useful utility – it puts together a lot of the principles from my original article, and does so in a way that’s easy to implement. It does a lot of stuff on the fly saving a lot of time and effort.
It would be nice if there was more information available on what’s it doing, rather than how good it is.
But, the proof is in the pudding, and this very blog is now working with PHP Speedy (all options turned on).
Which reminds me; during the install there are instructions on how to add PHP Speedy to WordPress. This involved adding code to index.php. I found this only worked on the main blog page and no others, but have found that adding the code to the header.php and footer.php instead works a treat.
If you’ve found this article of interest, then a PDF version is available for download below. I’m happy for you to use and distribute this, but please don’t edit it, sell it or generally be beastly.