Use Heroku config vars with PHP? Use Heroku config vars with PHP? heroku heroku

Use Heroku config vars with PHP?


Config vars on heroku manifest themselves as environment variables, so you should be able to access them from php like you would any other environment variable, eg. using getenv.

First, set the variable from your console:

heroku config:set MY_VAR=somevalue

Then, access it from your code:

$my_env_var = getenv('MY_VAR');