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.

MAIL_FROM_NAME=paul@paulund.co.uk
MAIL_FROM_EMAIL=paul@paulund.co.uk

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.

MAIL_FROM_NAME=paul@paulund.co.uk
MAIL_FROM_EMAIL=${MAIL_FROM_NAME}

UpChecker

Reliable uptime monitoring and instant alerts for any website downtime.

  • Uptime Monitoring
  • Performance Monitoring
  • SSL Certificate Alerts
  • Domain Monitoring
  • DNS Checker
  • XML Sitemap Monitoring