PHP code example of etelford / phpdotenv-include-extension

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

    

etelford / phpdotenv-include-extension example snippets


# Be sure to w Etelford\Dotenv(__DIR__);
$dotenv->load();

echo getenv('DATABASE_NAME'); // mydb
echo $_ENV('DATABASE_USERNAME'); // root
echo $_SERVER('DATABASE_PASSWORD'); // s3cr3t
echo env('DATABASE_PORT'); // 3306

// This creates the application
$app = new Illuminate\Foundation\Application(
    realpath(__DIR__.'/../')
);

// Add this to enable .env