src/Core/EnvironmentLoader.php
public function loadFile($path, $overload = false)
    {
        // Not readable
        if (!file_exists($path) || !is_readable($path)) {
            return null;
        }

        // Parse and cleanup content
        $result = [];
        $variables = Parser::parse(file_get_contents($path));
        foreach ($variables as $name => $value) {
            // Conditionally prevent overloading
            if (!$overload) {
                $existing = Environment::getEnv($name);
                if ($existing !== false) {
                    $result[$name] = $existing;
                    continue;
                }
            }

            // Overload or create var
            Environment::setEnv($name, $value);
            $result[$name] = $value;
        }
        return $result;
    }
public function loadFile($path, $overload = false)
    {
        // Not readable
        if (!file_exists($path) || !is_readable($path)) {
            return null;
        }

        // Parse and cleanup content
        $result = [];
        $variables = Parser::parse(file_get_contents($path));
        foreach ($variables as $name => $value) {
            // Conditionally prevent overloading
            if (!$overload) {
                $existing = Environment::getEnv($name);
                if ($existing !== false) {
                    $result[$name] = $existing;
                    continue;
                }
            }

            // Overload or create var
            Environment::setEnv($name, $value);
            $result[$name] = $value;
        }
        return $result;
    }
public function loadFile ( $ path , $ overload = false ) { // Not readable if ( ! file_exists ( $ path ) || ! is_readable ( $ path ) ) { return null ; } // Parse and cleanup content $ result = [ ] ; $ variables = Parser :: parse ( file_get_contents ( $ path ) ) ; foreach ( $ variables as $ name => $ value ) { // Conditionally prevent overloading if ( ! $ overload ) { $ existing = Environment :: getEnv ( $ name ) ; if ( $ existing !== false ) { $ result [ $ name ] = $ existing ; continue ; } } // Overload or create var Environment :: setEnv ( $ name , $ value ) ; $ result [ $ name ] = $ value ; } return $ result ; }
Load environment variables from .env file

@param string $path Path to the file
@param bool $overload Set to true to allow vars to overload. Recommended to leave false.
@return array|null List of values parsed as an associative array, or null if not loaded
If overloading, this list will reflect the final state for all variables
Load environment variables from . env file