PHP code example of zablose / dotenv
1. Go to this page and download the library: Download zablose/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/ */
zablose / dotenv example snippets
use Zablose\DotEnv\Env;
// Auto loader
(new Env())->setArrays(['PROTECTED'])
->read(__DIR__.'/../.env')
->read(__DIR__.'/../.env-extra');
use Zablose\DotEnv\Env;
$db_name = Env::string('DB_NAME', 'dotenv');
$db_password = Env::string('DB_PASSWORD');
$db_port = Env::int('DB_PORT');
$db_name = env_string('DB_NAME', 'dotenv');
$db_password = env_string('DB_PASSWORD');
$db_port = env_int('DB_PORT');