PHP code example of knorkfork / load-environment

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

    

knorkfork / load-environment example snippets


use KnorkFork\LoadEnvironment\Environment;

Environment::load(__DIR__ . '/.env');

echo Environment::getStringEnv('APP_ENV');

use KnorkFork\LoadEnvironment\Environment;

Environment::load(__DIR__ . '/.env', ['custom']);

// APP_ENV from .env will be overwritten by APP_ENV from .env.custom
echo Environment::getStringEnv('APP_ENV');

use KnorkFork\LoadEnvironment\Environment;

Environment::load(__DIR__ . '/.env');

echo getenv('APP_ENV');