PHP code example of climbx / dotenv

1. Go to this page and download the library: Download climbx/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/ */

    

climbx / dotenv example snippets


// PHP

use Climbx\Dotenv\Dotenv;

$dotenv = new Dotenv();
$envPath = __DIR__ . '/.env';

/*
 * Loads env vars into $_ENV and $_SERVER
 * without overwriting existing variables
 */
$dotenv->load($envPath);

/*
 * Loads env vars into $_ENV and $_SERVER
 * if a variable already exists, it is overridden.
 */
$dotenv->overload($envPath);