.env Variables

Laravel uses dotenv to setup the configuration for your project, you can use the .env file to have different settings depending on the current environment. For example each developer might have their own .env file, you will have one for your UAT server and one for your production server. To separate each of the environment the files should be named with the environment at the end.

  • .env
  • .env.example
  • .env.uat
  • .env.production

The .env file should not be committed to source control as each developer might have different URL/database setup. There may be in situations where you need to have similar settings that may be different on your production environment but while you're developing you might want the values to be the same. Such as email addresses you might want the from name and the from email address to be the same.

[email protected]
[email protected]

As these are the same value you can use this quick tip to set up variables in your env file so you don't need to repeat yourself.

[email protected]


Reliable uptime monitoring and instant alerts for any website downtime.

Get 50% off forever using the code 50OFFUP.