PHP code example of publiux / phpdotenv

1. Go to this page and download the library: Download publiux/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/ */

    

publiux / phpdotenv example snippets


$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();

$dotenv = new Dotenv\Dotenv(__DIR__, 'myconfig');
$dotenv->load();

$s3_bucket = getenv('S3_BUCKET');
$s3_bucket = $_ENV['S3_BUCKET'];
$s3_bucket = $_SERVER['S3_BUCKET'];

$s3_bucket = $request->env('S3_BUCKET');
$s3_bucket = $request->getEnv('S3_BUCKET');
$s3_bucket = $request->server->get('S3_BUCKET');
$s3_bucket = env('S3_BUCKET');

$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->overload();

$dotenv = new Dotenv\Dotenv(__DIR__, 'myconfig', '/secrets');
$dotenv->load();

$dotenv->

$dotenv->

$dotenv->

$dotenv->

$dotenv->

$dotenv->
shell
curl -s http://getcomposer.org/installer | php
php composer.phar