PHP code example of nichin79 / dotenv
1. Go to this page and download the library: Download nichin79/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/ */
nichin79 / dotenv example snippets
(new Nichin79\DotEnv\DotEnv(__DIR__ . '/../.env'))->load();
$config = [
'dsn' => $_ENV['DB_DSN'],
'user' => $_ENV['DB_USER'],
'pass' => $_ENV['DB_PASS'],
];
var_dump($config);
var_dump($_ENV);
var_dump($_SERVER);