PHP code example of pyncer / dotenv
1. Go to this page and download the library: Download pyncer/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/ */
pyncer / dotenv example snippets
use Dotenv\Dotenv;
use Dotenv\Repository\RepositoryBuilder;
use Pyncer\Dotenv\ConstAdapter;
// ...
$repository = RepositoryBuilder::createWithNoAdapters()
->addAdapter(new ConstAdapter('Vendor\\Namespace'))
->immutable()
->make();
$dotenv = Dotenv::create($repository, getcwd());
$dotenv->load();
// ...
echo \Vendor\Namespace\MY_ENV_VARIABLE;