Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minify / Obfuscate PHP Code [closed]

I use Haxe to generate PHP code. (This means you write you code in the Haxe language and get a bunch of php files after compiling.) Today a customer told me that he needs a new feature on a old project made with Haxe. He also told me that he altered some small things on the code for his own needs. Now I first have port his changes to my Haxe code and then add the new feature, because otherwise his changes will be overwritten by the next time I compile the project.

To prevent that this happens again I am looking for some kind of program that minifies / obfuscates the PHP code. The goal is to make the code unreadable / uneditable as possible.
The ideal tool would run under Linux and could process whole folders and all it containing files.

Anybody any suggestions?

like image 555
TheHippo Avatar asked Jan 14 '10 15:01

TheHippo


1 Answers

Why not use the php buid in function php_strip_whitespace()

string php_strip_whitespace ( string $filename )

Returns the PHP source code in filename with PHP comments and whitespace removed. This may be useful for determining the amount of actual code in your scripts compared with the amount of comments. This is similar to using php -w from the commandline.

like image 96
RoboTamer Avatar answered Oct 02 '22 23:10

RoboTamer