PHP code example of murilo-perosa / dot-env

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

    

murilo-perosa / dot-env example snippets


use MuriloPerosa\DotEnv\DotEnv;

// enter path to .env file
(new DotEnv(__DIR__ . '/../.env'))->load();


// php implementation
$value = getenv('YOUR_KEY');

// package implementation
$value = DotEnv::get('YOUR_KEY');

// package implementation with default value
$value = DotEnv::get('YOUR_KEY', 'DEFAULT_VALUE');