Lijiebin Lijiebin - 3 years ago 281
Ini Question

Why use dotenv library instead of parsing ini file?

Within PHP, *.ini files can be read by using

. 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?

Answer Source

It's a good question. I've found a few mentions on (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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download