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

davepgreene's avatar

Deployment, artisan commands, and environment variables

Hi,

My goal is to automate my deploys entirely and I was wondering about artisan commands and environment variables.

Best practice for deployment is to use environment variables to store sensitive information. I know Laravel uses dotenv to read the environment and that's awesome for the actual app.

However, I have several post-deploy artisan commands that I want to run and artisan uses the cli which apparently doesn't inject environment variables by default.

Any suggestions for how to automate this? I'm using Chef and I know about the before_migrate.rb hook but I can't think of how to use any of these tools.

0 likes
0 replies

Please or to participate in this conversation.