I have a product with a licensing system where i check if the license in public/license.txt is valid and if so project keeps running otherwise owner should contact to have a license . i give the source code itself so how to protect the licensing system
where should i place the script which checks the license ? because user can easily modify the script or even remove the line calling for the script entirely
right now i call the script in the beginning of public/index.php
so my question
1- where to place the script and call it
2- how to encrypt the file so no one will modify it
Create a private composer package and have the code in there. Of course they can still modify it, but it makes it quite hard as it will be overwritten with each update
@Maged Well you would need to have the package be part of your program at least!. But perhaps a better alternative is that YOU host the code, and just give them access to the frontend?
@maged You can’t give source code to a customer and then secure it. They have the code. Any licensing routine you put in place can be circumvented as you say.
“Encryption” also does nothing, because they can be easily defeated. Especially for a scripting language like PHP that needs to be interpreted. It has to get decrypted at some point to be able to be ran.
If you don’t want people pirating your software, then just don’t give them your code. If you want to license people and charge a recurring subscription, then build a SaaS instead.