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

AnaniKomlan's avatar

What is the best way to protect Laravel source code for a local customer installation?

I am currently working on SaaS in Laravel and for a local deployment at a client I would like to encrypt the source code of the project before copying. How to do it or what are the possible solutions ?

0 likes
12 replies
AnaniKomlan's avatar

@jaseofspades88 I was planning to install wamp or docker on the client machine and copy the laravel 10 source code to a specific folder and create a virtual host.

1 like
jaseofspades88's avatar

@AnaniKomlan deploy it to a server and put your code in a private repository.. that's the most protection your code needs

1 like
Tray2's avatar

The short answer is no, you can't.

The slightly longer answer is that it is possible to do, but most options are not that good.

1 like
Tray2's avatar

@AnaniKomlan Not really no, unless you host it somewhere where only you have access.

1 like
adityakunhare's avatar

I think you can use https://nativephp.com/ (PHPNative) and deploy it to local machine of client. It uses laravel as a development framework and build it as an app for desktop using electronjs(I guess)

hope it helps

1 like
adityakunhare's avatar

@AnaniKomlan if you are not running out of time, you can test on your own I guess. Otherwise for windows install laragon or something to the windows and install. Setup the project. That is the only way.. For Linux, LAMP setup little bit time taking..

Snapey's avatar

@adityakunhare nativephp is really only an option if the client needs 1 copy. If it needs to be distributed to the organisation then this would be a nightmare for the OP.

And, at this point, NativePHP code is not obfuscated

martinbean's avatar

@ananikomlan If you don’t want people to steal your source code, then don’t give them it.

I’m not sure why clients would be doing “local” installations in the first place if you‘re building a SaaS. The entire point of a SaaS is that you offer the software as a service.

1 like
Snapey's avatar

I don't know of specific solutions, but you could perhaps licence parts of the code the same way that Laravel does with Spark. Alternatively give them a local copy but have parts of the application only resolved by a call to an API that you host.

Please or to participate in this conversation.