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

kfirba's avatar
Level 50

Deployments in Forge

Hey.

I think it's very important to persist the storage folder as it may contain uploaded files, logs and such.

Does Laravel Forge creates a symlink to a storage directory in the root folder? If not, is it possible to tell it to do so on deployments?

Also, does it persist the .env file?

0 likes
3 replies
lindstrom's avatar

Forge doesn't create the symlink although you could do it manually. Envoyer does create a symlink for storage. If you can kick in the extra $10/month, Enovoyer is really worth it. Maybe someday Taylor will combine them, but until then using both makes life easier as you don't have to deal with a lot of the manual stuff like creating symlinks.

Yes, the .env file is persisted in that you can install it using the Forge interface. You should gitignore your .env but generally include your .env-example (with no passwords).

Log into Forge -> manage server -> manage site and look to the bottom right for the button that says 'Edit Files'. Click it and the first option is Edit Environment File.

kfirba's avatar
Level 50

@lindstrom thanks for the quick reply.

Each time I will deploy with Forge, it will override my entire project folder which means that if I create a symlink it will be overridden. Can I add like a post deployment hook to create it manually?

lindstrom's avatar

@kfirba I don't have a project I'm deploying with Forge at the moment, but you could add it to the deployment script just like you might do for running gulp, etc. It's pretty much what Envoyer does with the only difference being that Envoyer deploys to a releases/[timestamp] directory, removes the /storage folder if it finds it in the repo then recreates it as well as the symlink. In Envoyer the dir structure is like this where /current is symlinked to the timestamped directory and /storage:

/current
/storage
/releases/[timestamp]

Please or to participate in this conversation.