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

alikalan's avatar

How can I obfuscate the codes in my Laravel app?

I work at a project and security teams ask me obfuscate the code where I use tables name and column name I search solution on google and not found a good answer for this. so i never like to use Commercial software like Zend Guard etc,

please Help me.

for example change this

DB::table('games')->where('club_id', $club_id)

to this DB::table('games')->where('CSSWDFadsadads', $club)

I want the code to be illegible for the customers.

i don't want use these software

  • Zend Guard
  • IonCube
  • SourceGuardian
  • etc.
0 likes
19 replies
tykus's avatar

Why; even the variable name, why?

martinbean's avatar

@alikalan If you don’t want people to see your code, then don’t put it in their hands.

2 likes
alikalan's avatar

I work at a project and security teams ask me obfuscate the code where I use Database name and column name I search solution on google and not found a good answer for this. so i never like to use Commercial software like Zend Guard etc,

please Help me.

alikalan's avatar

@martinbean If hackers access to source codes for any reason, they can easily find your database structure

Snapey's avatar

Are you sure you have this right? "If hackers access to source codes".

Knowing the database table structure is the least of your problems at this point.

Either use a proven, commercial product (someone whose promise is to protect your code) or don't bother.

So, lets say you find a product to obfuscate your code. What are you going to apply it to? Just the code on your production server? You still need the original code in order to be able to maintain it.

Then you still have "If hackers access to source codes" since they can get it from your machine, or from the code repository.

Check the requirements. Are you sure they don't just mean to encrypt the data in the tables?

besides your code should be secure even if you shared it with the hackers. If they can look at the code and find a weakness then that weakness exists irrespective of whether you made it easier with the source code. You and your security team should be focussed on making the application secure. Not the source code.

martinbean's avatar

@alikalan If hackers can read your source code then you’ve already lost. Obfuscating column and table names isn’t going to help you when they can just read your database credentials and then connect to the database directly.

1 like
alikalan's avatar

@martinbean I do not mean that hackers now have access to my code, but I say that if for any reason my code falls into the hands of anyone who can not see the structure of the database. Sorry if I could not express my point correctly

alikalan's avatar

@snapey Sorry .I could not express my point correctly. I do not mean that hackers now have access to my code. I search a way to obfuscate all of my project . only this.

Snapey's avatar

Sorry I could not express my points. Good Luck

3 likes
rawilk's avatar

Who cares if someone knows the structure of your database? Like the others said, focus on securing your application and your server too. Obfuscation is not security.

3 likes
alikalan's avatar

The solution is to use SourceGuardian. i use it for trail . But @wilk_randall is right.Obfuscation is not security.I focus on securing my application.

alikalan's avatar
alikalan
OP
Best Answer
Level 1

Finally i found solution. i use this Repository https://github.com/pk-fr/yakpro-po first install it and then copy your laravel project ( It is better to just copy route and app folder ) to yakpro-po installed folder.

then run php yakpro-po.php your-laravel-directory -o output directory

Thanks for not helping

3 likes
@rushabh999's avatar

I have a situation My client is not releasing money... even I have done a great job now he is asking me to set up a project on his own server then he will release money

Tell me what should I do now... Payment is due for the last two months

Snapey's avatar

@@rushabh999 what does your contract say?

Oh, and what does this have to do with this question?

kokoshneta's avatar

@@rushabh999 Please don’t hijack other people’s threads with new, unrelated questions. Also, your question is a legal one, not Laravel-related at all; it doesn’t belong here to begin with. You should ask a lawyer in your own country about chasing payment from clients.

Please or to participate in this conversation.