Handling multiple environments on one computer with Laravel 4x
What if you want to run several environments on the same computer with the same name, for example, intermediate and production and local environments?
The best solution for handling environments in Laravel 4x - and this can be done by adding one liner to you vhosts file- or .htaccess:
Set local environment variable
In vhost or .htaccess, add an intermediate for your local installation, for example:
SetEnv LARAVEL_ENV staging
and the same in producing .htaccess or vhost:
SetEnv LARAVEL_ENV production
Then the usual detectEnvironment () function in start.php.
$env = $app->detectEnvironment(function() { // Default to local if LARAVEL_ENV is not set return getenv('LARAVEL_ENV') ?: 'local'; });
We have not forgotten local ... and the cool part is that your default setting will be local if no environment variables are found in vhost or .htaccess, as they will be found in other settings.
source share