Tiny PHP – Minifying & Obfuscating Your Code
Tiny PHP is a little tool we put into our labs that performs some “minification” on PHP code. Is it a trivial and completely academic exercise because PHP doesn’t benefit from being smaller like CSS or Javascript? Yes. But it’s still kind of cool.
What it does
In short, the goal is to take a snippet, function, or page of PHP and condense it. It will replace variables, remove comments, and/or remove whitespace. To call this tool an obfuscator is not really right, but it does make code harder to read. It also has some fancy options that allow you to exclude certain variables from being replaced so your classes calls don’t get mushed up.
What it doesn’t do
The Tiny PHP tool does not attempt to minify function names, class names, or any references related to those objects. Were not trying to take your entire app and make it stupidly hard to maintain, there are lots of other programs out there to do that.
How we use it
There is really no reason to use this type of tool in production code. If you are just messing around though, it is sometimes nice to take a set of methods or functions, and condense them into four or five lines, if their only purpose is to simply exist and never be edited. Also, if an application has spiraled into a mess of variables that have absolutely no meaning, there becomes no difference between them being long and annoying, or short and sweet.
Recent Comments
Archives
- April 2023
- January 2023
- November 2022
- May 2022
- March 2022
- January 2022
- December 2021
- April 2021
- December 2020
- October 2020
- August 2020
- July 2020
- March 2020
- February 2020
- January 2020
- December 2019
- November 2019
- October 2019
- January 2019
- December 2018
- November 2018
- August 2018
- July 2018
- April 2018
- March 2018
- November 2017
- October 2017
- February 2017
- October 2016
- August 2016
- July 2016
- November 2015
- October 2013
- February 2013
- January 2013
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- February 2012
- December 2011