PHP code example of hindbiswas / phpdotenv
1. Go to this page and download the library: Download hindbiswas/phpdotenv 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/ */
hindbiswas / phpdotenv example snippets
Hindbiswas\Phpdotenv\DotEnv;
$dotEnv = new DotEnv(__DIR__); // Location where .env file exists
$dotEnv->load();
// To access variables
// getenv()
$variable_value = getenv('TEST_NAME');
// $_ENV[]
$variable_value = $_ENV['TEST_NAME'];
use Hindbiswas\Phpdotenv\DotEnvFromExample;
. '/path/to/example/');
$env->to(__DIR__); // This line is not