I would never commit the env. Simple as that. Any default values are set in config anyways
If I was forced to I would encrypt it :)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I would like to see what the best practice or consensus is regarding where to store environment variables.
I know not to store passwords, for example, in a committed .env file, and instead use AWS Secret (or equivalent) for that. On the other hand, I have not problem committing the app name (I don't in reality because I don't commit the .env file at all, but that's beside the point).
So where do people draw the line? What do you use secrets for, and what instead you just keep it in an .env file on the server?
Please or to participate in this conversation.