As a workaround you can add the environment option when calling artisan commands like so:
php artisan env --env=local
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I recently started using laravel homestead (2.0) for my development environment, but i encountered a problem. In my homestead.yaml file i setted my environment variables like so:
variables:
- key: APP_ENV
value: local
and in my bootstrap/start.php i do:
$env = $app->detectEnvironment(function(){
return getenv('APP_ENV');
});
And this works fine in the browser. When i var_dump(getenv('APP_ENV')) i get local as response. However, when i do php artisan env, i get the following:
Current application environment:
I also got my database variables like host and usernames as environment variables, but those arent set in php artisan neither. I've searched a while now and havent found any answer. Homestead should provision those variables, but it only does a small job of doing so. Am i doing something wrong? Please help because im kinda stuck atm...
Please or to participate in this conversation.