0

I read the article Submitting an Magento 2 Extension and understood that it was necessary to provide the source code to technical review. But as I understand it, I need to choose a license for my module. I want my module to be paid one with non-distributable source code. If I understood correctly, the source code will be available for anyone who buys my module.

How to create a license in this case? Can I choose an existing one?

1 Answer 1

2

First of all you are writing code in a script language. It means it is not compiled to binary form but it is compiled on the fly and executed. Just for that reason you need to provide a source code. If you really want to hide the code you can use encoders like ZendGuard or ioncube they will encrypt the code and require a php module to be installed in order to decipher and execute them.

That being said I personally try to stay away from such modules in magento not because I want to steal the code but because often it happens that the client want to tweak the functionality or extend it. With encrypted code it is hard or sometimes impossible.

If you do not want to pay for any of the two or similar modules you can encrypt the code yourself. The most straightforward way is to use some crypt function or otherwise break the code into something that can be properly evaluated by eval function. I encountered breaking the code into chain of chr(12).chr(14).... Such chain can be further obfuscated with base64 or bcrypt. In the end your file will looke like eval(base64_decode($strangeString));

As to choosing license I misunderstand your question. I believe none of the open source license by default restrict redistribution. So you need to create a custom one and attach it to the module. You can easily copy one of the proposed and remove distribution clause.

3
  • Thanks for your answer. I agree with you that hiding the source code is a bad idea. It's best to provide it. In this case, which license to choose to allow modification the source code, but prohibit the distribution? Commented Mar 10, 2017 at 20:36
  • @vaddemgen I updated the answer.
    – Zefiryn
    Commented Mar 10, 2017 at 20:58
  • @Zefiryn so do you mean to say even paid extension with a license can be used for distribution even if it has a clause in it. Is there any way to catch if it's done by someone Commented Sep 7, 2019 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.