PHP code example of sobyte / dotenv-php

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

    

sobyte / dotenv-php example snippets


// A simple .env.php

return [
    "APP_ENV" => "local",
    "APP_DEBUG" => true,
    // ....
];



// assume .env.php is in current directory (__DIR__)
(new \Sobyte\DotEnv\DotEnv(__DIR__))->load();


composer 


echo env('APP_ENV'); // => local