as part of a training on Stripe on Symfony, I am trying to set up an environment variable for testing.
So I have to set a variable to false for testing. And for other environments, the variable must be true.
So, I did this :
#.env.test:
VERIFY_STRIPE_EVENT=false
and
#.env:
VERIFY_STRIPE_EVENT=true
Next, I want to test if I have the good value.
So in my controller, I test : dd(getenv("VERIFY_STRIPE_EVENT"));
with dev environment.
But it returns false.
It means that I can't get the variable. Can someone help me please ?
Add this to line to .env
APP_ENV=prod
Add this to line to .env.test
APP_ENV=test
Add this to line to .env
APP_ENV=prod
Add this to line to .env.stage
APP_ENV=stage
Now, your getenv("VERIFY_STRIPE_EVENT") will return the correct variable depending on which environment you are in.