Other answers/comments are wrong.
You only store one .env per environment. That is:
- Your local machine will have a .env with your local config
- The staging maching will have a .env with your staging config,
and
- Your production maching will have a .env with your production config
So it is always one .env file per machine. Laravel will load that config from that file.
note that .env file is in .gitignore, .env.example is not
When testing on local machine using PHPUnit you can add env variables in phpunit.xml
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_DEBUG" value="true"/>
<env name="APP_KEY" value="some crazy value"/>
<env name="DB_DRIVER" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
</php>