Within PHP, *.ini files can be read by using parse_ini_file()
. However, various frameworks (Laravel included) opt to, instead, bring in a separate library to parse an environment file.
What is the reasoning behind using this "dotenv" solution instead of ini files and the built-in PHP function?
It's a good question. I've found a few mentions on php.net (search by the keyword parse_ini_file
). The main problem, I suppose, is that parse_ini_file
doesn't support some features, such as constants, expressions, etc. Also, I guess, some developers would like to perform such operations in OOP style.