PHP code example of quillstack / dotenv

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

    

quillstack / dotenv example snippets


use Quillstack\Dotenv\Dotenv;

(new Dotenv('.env'))->load();

env('APP_DEBUG');   // true, a boolean
env('APP_NAME');    // 'quillstack'
env('DB_PORT');     // 5432, a number

env('MISSING', 'a default');   // 'a default'

$host = 

env('DB_PORT');    // 5432, still a number
env('PASSWORD');   // 'hunter2#7'
env('QUOTED');     // 'a # inside quotes'

env('DB_PORT');   // 5432

env('PRICE');   // '${9.99}'

$values = (new Dotenv('.env'))->parse();
// ['BASE' => 'https://example.org', 'URL' => '${BASE}/v1']
text
APP_DEBUG=true
APP_NAME=quillstack
DB_PORT=5432