PHP code example of flexic / dotenv

1. Go to this page and download the library: Download flexic/dotenv library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flexic / dotenv example snippets


$dot_env = new \Flexic\DotEnv\DotEnv();

$data = $dot_env->parseFile('/path/to/dot/env/file/');
$dot_env->populate($data);

# Variables from .env file are now avaiable in $_ENV array