Laravel assumes that .env
file should describe environment, and it should not be committed to your repo.
What if I want to keep both .env
f
Use Dotenv::load() for custom .env file
laravel 5.1 with vlucas/phpdotenv ~1.0
if ($_SERVER['HTTP_HOST'] == 'prod.domain.com') {
Dotenv::load(__DIR__ . '/../','.production.env');
} else {
Dotenv::load(__DIR__ . '/../','.dev.env');
}
OR
laravel 5.2 with vlucas/phpdotenv ~2.0
$dotenv = new Dotenv\Dotenv(__DIR__, 'myconfig'); // Laravel 5.2
$dotenv->load();
PHP dotenv
In bootstrap/app.php