How to permanently set composer env variables in a .env file? - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Friday, May 5, 2023

How to permanently set composer env variables in a .env file?

I'm using PHP composer to deal with env variables and I've set a few in a .env file. Composer recognizes it and adds them to $_ENV just fine.

However, is there a way to keep a synchronous relationship between $_ENV and .env file? This way composer would override the file with updated $_ENV information so I could use it afterwards.

Is it possible? Since $_ENV only keeps the actual variables per session. I'm asking this because I wanted to keep refreshing an API token in a file. I'd also appreciate if there's some workaround or if I actually didn't understand the concept properly.



source https://stackoverflow.com/questions/76176212/how-to-permanently-set-composer-env-variables-in-a-env-file

No comments:

Post a Comment