PHP code example of tomrf / dotenv

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

    

tomrf / dotenv example snippets


$dotEnvLoader = new \Tomrf\DotEnv\DotEnvLoader();

// loadImmutable() will not overwrite existing environment variables
$dotEnvLoader->loadImmutable(__DIR__ . '/.env');

// load() will overwrite existing environment variables
$dotEnvLoader->load('/path/to/dotenv/file');

public function load(
    string $filename
): void

@throws   \Tomrf\DotEnv\DotEnvLoaderException if parsing fails or if the file is not found

public function loadImmutable(
    string $filename
): void

@throws   \Tomrf\DotEnv\DotEnvLoaderException if parsing fails or if the file is not found