PHP code example of linna / dotenv

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

    

linna / dotenv example snippets


$env = new Linna\DotEnv\DotEnv();
$env->load('.env.test');

$app = $env->get('APP');
$app_env = $env->get('APP_ENV');

//string 'linna' (length=5)
var_dump($app);

//string 'production' (length=10)
var_dump($app_env);

phpinfo(INFO_ENVIRONMENT);