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    
Last Updated Ratings Unique User Downloads Download Rankings
2020-05-20 (Yesterday) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
orbisius-dot-env 1.0GNU Lesser Genera...5PHP 5, Language, Configuration, Parsers
Description Author

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.

  Performance   Level  
Name: Svetoslav Marinov <contact>
Classes: 7 packages by
Country: Canada Canada
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

 

Details

orbisius-dot-env

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 https://orbisius.com

Usage Notes

Check the example.php file.

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

.env Example

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

# You can have comments
ENV=dev
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 = https://my-cool-saas-app.orbisius.com

author_url = https://orbisius.com
author_product_1_url = https://qsandbox.com
author_product_2_url = https://wpsandbox.net
author_product_3_url = https://wpdemo.net
author_product_3_url = https://go359.com

Customizations / Support

We do offer paid support & customizations. Contact us at https://orbisius.com/contact for more info.

License

MIT

  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 README.md Doc. Documentation

 Version Control Unique User Downloads  
 100%
Total:0
This week:0

For more information send a message to info at phpclasses dot org.