Add Environment Variables In Laravel Homestead

Add Environment Variables In Laravel Homestead


Apr 12 2017, 08:03 in Web Development

As it may seem an easy thing to do, and to be honnest : it is, creating environment variables in your Homestead Virtual Machine is something you cannot find in the documentation.

While it is missing from the official Laravel Documentation, you can still find the info on a lost google page..

So today I'm saving you some trouble.

In order to add new environment variable in Laravel Homestead, simply add these lines in your Homestead.yaml file:

    variables:
        - key: APP_ENV
          value: dev
        - key: SOME_KEY
          value: someValue
        - key: FOO
          value: bar

Of course, don't forget to run vagrant reload --provision in order for your VM to be updated.


Share:
Like:

Disable AdBlock on this domain and offer me a cup of coffee :)