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

aligajani's avatar

Multiple Environments in one repository and making it work on Forge

I was just wondering, I have this in my main repository in start.php (Laravel 4.2)

$env = $app->detectEnvironment(function() { return getenv('ENV') ?: 'local'; });

I use this to detect environments and in Forge, I have ENV set as PRODUCTION.

This works as I have 2 config folders, namely local and production.

Now, I wish to deploy this repo in 2 different instances.

It's a forum system but different target markets.

I can create 2 new folders inside config namely market-1 and market-2.

Now, I can have 2 more Forge servers setup with ENV set respectively.

Now it comes down to this block of code. How will I detect it?

More importantly, will this even work or am I just crazy?

0 likes
0 replies

Please or to participate in this conversation.