Load different .env file with a Symfony 4 command
问题 .env file is parsed when running a Symfony 4 command (if dotenv is available). This is working fine when developping, but also, I want to test my code (so another environment), hence I need to load another .env file. I love what Docker did to run a container: docker run -e MYVAR1 --env MYVAR2=foo --env-file ./env.list ubuntu bash So I am looking to achieve same thing with Symfony: php bin/console --env-file ./.env.test right now, I am doing this: export $(grep -v '^#' .env.test | xargs) &&