Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Maged's avatar
Level 6

Check project license

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

0 likes
6 replies
Maged's avatar
Level 6

@sinnbeck won't user just remove requiring the package in composer.json ?

Sinnbeck's avatar

@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's avatar
Level 6

@Sinnbeck already doing that for long time now, but i'm trying to figure other ways to reduce the headache of hosting every product i sell.

Sinnbeck's avatar

@Maged then I don't see any way except using a package for most of the features, that you control (a bit like Nova)

Or use a compiled language (not php)

martinbean's avatar

@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.

1 like

Please or to participate in this conversation.