1. Go to this page and download the library: Download chillerlan/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/ */
chillerlan / php-dotenv example snippets
$env = new DotEnv(__DIR__.'/../config', '.env');
$env->load(['foo']); // foo is > bar
$foo = $env->FOO; // -> bar
// dynamically set a variable
$env->set('foo', 'whatever');
$env->FOO = 'whatever';
$foo = $env->get('FOO'); // -> whatever
// ...
// variable substitution
$foo = $env->get('WHAT'); // -> foo-bar
// avoid the global environment
$env = (new DotEnv(__DIR__.'/../config', '.env', false))->load();
$foo = $_ENV['FOO']; // -> undefined
$foo = $env->get('FOO'); // -> bar
$foo = $env->FOO; // -> bar