PHP code example of lane4hub / dotenv

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

    

lane4hub / dotenv example snippets


use Jardis\DotEnv\DotEnv;

$dotEnv = new DotEnv();
// Load values into $_ENV
$dotEnv->load($appRootPath);

// Do NOT load values into $_ENV and return the result as an array
$domainEnv = $dotEnv->load($domainRootPath, false);

    public function __construct(
        ?GetFilesFromPath $fileFinder = null,
        ?GetValuesFromFiles $fileContentReader = null,
        ?CastTypeHandler $castTypeHandler = null
    ) {
        $this->getFilesFromPath = $fileFinder ?? new GetFilesFromPath();
        $this->castTypeHandler = $castTypeHandler ?? new CastTypeHandler();
        $this->getValuesFromFiles = $fileContentReader ?? new GetValuesFromFiles($this->castTypeHandler);
    }