PHP Classes

Orbisius PHP dotenv Parser Class: Parse dotenv configuration files and assign values

Recommend this page to a friend!
  Info   View files Documentation   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 60 All time: 10,463 This week: 206Up
Version License PHP version Categories
orbisius-dot-env 1.0GNU Lesser Genera...5PHP 5, Language, Configuration, Parsers


This class can parse dotenv configuration files and assign values.

It takes the path of a given file in dotenv format and parses it to extract the configuration values.

The class can also assign the configuration values to the respective environment variables and PHP constant values.

Innovation Award
PHP Programming Innovation award nominee
May 2020
Number 8
dotenv is a file format that defines configuration variables for customizing details of operation in the environment that an application is running on.

This package can parse dotenv files to extract and assign environment configuration variables that PHP applications can access using the $_ENV or the $_SERVER superglobal array variables or the getenv function.

Manuel Lemos
Picture of Svetoslav Marinov
  Performance   Level  
Name: Svetoslav Marinov <contact>
Classes: 7 packages by
Country: Canada Canada
Age: 43
All time rank: 715 in Canada Canada
Week rank: 289 Down7 in Canada Canada Down
Innovation award
Innovation award
Nominee: 4x

Winner: 1x



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.

This class was created by

Usage Notes

Check the example.php file.

$dot_env = Orbisius_Dot_Env::getInstance();
$data = $dot_env->read();

.env Example

You can comment your .env file using the # character. E.g.

# You can have comments
db_name = orbisius_db
db_user = orbisius_user
db_pass = orbisius_pass # you can have a comment here too

# Leave some lines blank
api_url =

author_url =
author_product_1_url =
author_product_2_url =
author_product_3_url =
author_product_3_url =

Customizations / Support

We do offer paid support & customizations. Contact us at for more info.



  Files folder image Files  
File Role Description
Accessible without login Plain text file .env_example.txt Doc. Documentation
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Plain text file orbisius_dot_env.php Class Class source
Accessible without login HTML file README.html Doc. Documentation
Accessible without login Plain text file Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:10,463
This week:206Up