Devs.tw 是讓工程師寫筆記、網誌的平台。歡迎您隨手紀錄、寫作,方便日後搜尋!
php-dotenv-safe
inspired from https://github.com/rolodato/dotenv-safe
if the env variable is required, define it in the .env.example
you can give it default value in the .env.example
or just give it default value in env
as the second parameter
for team work,
env
second parameter. and it's almost equal to hard-coded.env.example
to force everyone set it upfor personal project
.env.example
in laravel, where to put default value? env 2nd param or in .env.example?
so it actually breaks single source of truth.
with php-dotenv-safe, the default value is always guaranteed.
so don't use second parameter at all.
force developers to set VAR=null in the .env file.
so they know they might just disable some features.