How to protect your PHP source code? You might be worried about giving away your secret sauce or having it reverse engineered.
Another good reason for wanting to protect your code is delivering the code to a clients server / hosting before final payment has been made for the development of the code.
I have experienced this first hand! I was very surprised to find a delivery of code for sign off was encrypted, I hadn’t seen that before. Sure enough when we asked the development company they said they would remove the encryption once the final payment had been made (there already had been a number of part payments through the project).
So definitely a useful tool for small shops and freelancers, make it a part of your contract that the source code will be decrypted when fully paid for.
We also had another client who wanted to distribute PHP code on USB thumb sticks. Not recommended, but it is possible to run a web server like that, using a SQLite database. Given the accessibility of a USB thumb stick rather than a Linux server, we encrypted the PHP code to protect it.
Here’s a couple of PHP encoders that we’ve used:
So encode, obfuscate and protect your code, if you feel the need, especially if you aren’t 100% confident of a client paying you.
Have you experienced a similar situation before, please share below in the comments. If you would like more useful tips like this, please subscribe to be updated on new ones.