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

Friedrich's avatar

How to hide code in laravel then use a method inside of it?

How can I hide a code then use a function inside of it for example:

function fixdata(){
        $carbon = new Carbon();
        $carbon->timezone('Asia/Manila');
        $day=Carbon::createFromFormat('Y-m-d H:i:s', $carbon)->format('F d, Y, l');
        $date=("October 30, 2022, Sunday");
        if($day >= $date){
           return "BROKEN APP CONTACT DEVELOPER";
        }
    }

I want to use this code in controller but I want it hidden in short this is not visible in file structure?

0 likes
13 replies
Friedrich's avatar

@SilenceBringer I want to hide this code so when the client inspecting the files it wont visible may i use dll files then inside the dll files that code was written then I useda function

Lumethys's avatar

why do you want to hide a piece of code in the backend?

1 like
Lara_Love's avatar

use if like for role thet see it just admin and manager

@if(auth()->user()->is_admin )
see
@endif
1 like
Friedrich's avatar

@LoverToHelp thanks for idea but I want is hide this code may i use a dll then use a function inside of it somthing like that

Sinnbeck's avatar

That's not how php works. Php is not a compiled language so you cannot compile it to "hide" stuff. Pick a compiled language

3 likes
martinbean's avatar

Up

@friedrich Stop doing this. Your question is no more important than any one else’s. If your question isn’t getting any replies, then it means it’s not described well. So add more context; don’t keep posting “Up” every few hours.

Given you were asking about how to add a time bomb to an application the other day and now you’re asking how to “hide” code in an application, you really do sound like a malicious piece of crap, and I’d want you nowhere my team or project.

1 like
Jalall2kh's avatar
Level 1

My friend I think you can hide it inside the Authentication middleware or inside methods used in it ... I tried ut before it'll work .. This code to guarantee that they'll pay you right??

1 like

Please or to participate in this conversation.