Tino
Tino

Reputation: 3368

Laravel 5 environment detection

I'm trying to get environment detection to work, so that I can use the .env.local.php file and all the other goodies, but somehow I cannot get it to detect the right environment.

I have added bootstrap/environment.php

<?php

$env = $app->detectEnvironment(array(

    'local' => array('mylocalmachinename') 

)); 

But when I php artisan env, I always get production instead of local.

Anyone know what the problem is?

Upvotes: 0

Views: 2443

Answers (1)

Laurence
Laurence

Reputation: 60040

Environment detection has changed in Laravel5.

You now put a .env file in the project root

APP_ENV=local

Then on another computer - you might do

APP_ENV=staging

You can then add additional environmental items - i.e.

APP_ENV=local
APP_KEY=SomeRandomString
DB_USERNAME=homestead
DB_PASSWORD=homestead

Upvotes: 3

Related Questions