File: example.php

Recommend this page to a friend!
  Classes of Svetoslav Marinov  >  Orbisius PHP dotenv Parser Class  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Orbisius PHP dotenv Parser Class
Parse dotenv configuration files and assign values
Author: By
Last change: loading the orbisius_dot_env class
Date: 1 month ago
Size: 562 bytes
 

Contents

Class file image Download
<?php

require_once(__DIR__ . '/orbisius_dot_env.php');

$dot_env = Orbisius_Dot_Env::getInstance();

// make the class look for the file.
$data = $dot_env->read();

// or specify the .env file directly.
// $data = $dot_env->read('/path/to/.env');

// Updates env, $_ENV, $_SERVER if the value doesn't exist already
$dot_env->updateEnv($data);

// override any existing values
$dot_env->updateEnv($data, true);

//
$dot_env->defineConsts($data);

// OR define the consts with this prefix
//
// $dot_env->defineConsts($data, 'MY_APP_');


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