3

I am using Laravel 5.4 and vlucas/phpdotenv library.

I wants to take reference of one env variable to other env variable e.g.

APP_NAME: JUSTDOIT
SIGNUP_KEY: JUSTDOIT_SIGNUP

here in SIGNUP_KEY I wants to use whatever APP_NAME it is.

miken32
  • 42,008
  • 16
  • 111
  • 154
Chintan7027
  • 7,115
  • 8
  • 36
  • 50

1 Answers1

6

Ahh, I found the answer here, Not removing the question as it may help to other,

It's possible to nest an environment variable within another, useful to cut down on repetition.

This is done by wrapping an existing environment variable in ${…} e.g.

APP_NAME: JUSTDOIT
SIGNUP_KEY: ${APP_NAME}_SIGNUP

additionally if you wants to use space in variable value then encluse this with "quotes" e.g.

SIGNUP_KEY: "${APP_NAME} SIGNUP"

Reference: https://github.com/vlucas/phpdotenv#nesting-variables

Chintan7027
  • 7,115
  • 8
  • 36
  • 50