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

marketingmavens's avatar

Envoyer Environment Management Laravel 4

Trying to setup a Laravel 4 application with Envoyer I successfully setup a Laravel 5 application w/o any issues. However for the environment variables for a L4 application it doesn't create the symlink of /home/forge/domain/current/.env.php -> /home/forge/domain/.env like I thought it would.

I manually created the symlink in the current directory thinking maybe it would apply to the new deployment but that didn't work. Wondering if anyone has any success with this yet.

It does route the storage path correctly since that is different in L4 vs L5 just didn't do the .env.php file, unless I didn't do something correct.

0 likes
5 replies
marketingmavens's avatar

So I found a way to do this if anyone else runs into this.

Deployment hooks! -- love them.

I just added a deployment hook to create the symlink after the Install Composer Dependencies. The hook was this:

ln -s /home/forge/domain/.env {{release}}/.env.php

Switch out /home/forge/domain with whatever is the path to your project.

For the environment management in envoyer, I just put the php array code like this:

<?php return [
    'FOO' => 'BAR',
];

So the .env file on your server has the php code and the .env.php file just points to it. Seems to be working fine. If there is a better way to do this let me know.

michaeldyrynda's avatar

@marketingmavens Is Envoyer syncing the environment as .env for a Laravel 4 project instead of .env.php by default?

If so, might be worth reaching out to Taylor to ask if this is intended.

marketingmavens's avatar

@deringer ya Envoyer synced a .env to the .env file even though it was a Laravel 4 project. I submitted a ticket/support request about it. I know on Forge even w/ L4 project when you create the environment variables it adds to both a .env.php and a .env file.

michaeldyrynda's avatar

Yeah cool - let us know how you go. Wonder if it was just an oversight or intended behaviour.

marketingmavens's avatar

So Taylor replied, he suggested to use the DotEnv library in my L4 app, I changed it over to that which is better anyway because then you can set the environment with the DotEnv like you do in L5 instead of another way.

2 likes

Please or to participate in this conversation.