Orbisius Dot Env is a free php class that allows you to read .env project files.
It is just one file and doesn't have any dependencies.
If the file is not passed the class will try to look for .env starting from Document Root, then checking if WordPress' const ABSPATH is defined and try one level up.
The class is very efficient and doesn't currently use regular expressions at all.
When it parses the key names are automatically uppercases them.
It can define the values in environment, $_ENV, $_SERVER etc. and also define php constants if they haven't been defined just yet.
For more information check
Referral Note: When you purchase through an referral link (if any) on this page, we may earn a commission.