Laravel utilizes the DotEnv PHP library by Vance Lucas. Using this library we can easily configure the application settings and we can have different configuration values based on the environment where the application is running.

The root directory of your application will contain the .env file (if not copy and rename .env.example to .env)and this file file should not be committed to your application’s source control, since each developer / server using your application could require a different environment configuration.

If you are developing with a team, you may wish to continue including a .env.example file with your application. By putting place-holder values in the example configuration file, other developers on your team can clearly see which environment variables are needed to run your application

You may also create a .env.testing file. This file will override values from the .env file when running PHPUnit tests or executing Artisan commands with the --env=testing option.

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.

If these are the same values you can use this simple trick to set up variables in your eve file so you do not need to repeat yourself.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets.