PHP code example of devcoder-xyz / php-dotenv

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

    

devcoder-xyz / php-dotenv example snippets



use PhpDevCommunity\DotEnv;

$absolutePathToEnvFile = __DIR__ . '/.env';

(new DotEnv($absolutePathToEnvFile))->load();

/**
 * Retrieve the value of DATABASE_DNS
 */
var_dump(getenv('DATABASE_DNS'));
bash
composer