PHP Classes


Recommend this page to a friend!
  Classes of Svetoslav Marinov   Orbisius PHP dotenv Parser Class   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Orbisius PHP dotenv Parser Class
Parse dotenv configuration files and assign values
Author: By
Last change:
Date: 3 years ago
Size: 1,522 bytes


Class file image Download


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.