The humble .env file is a useful and low-tech way of storing persistent environment variables. Drop the file on your server and let your PHP scripts consume it with glee. But consume it how? There are lots of excellent parsing libraries for PHP. But isn't there a simpler way? Yes! You can use PHP's parse_ini_file() function and it works. But… .env and .ini have subtly different behaviour which …

you are viewing a single comment's thread
view the rest of the comments
[–] 3 points 6 months ago (1 child)

If you can drop a .env file on a server. You can drop a well formed .ini file instead. I don't see any reason to ever parse a env file as a ini file.

  • source
  • hideshow 1 child comment