Skip to content

1.4.9

Compare
Choose a tag to compare
@ReactMVC ReactMVC released this 25 Aug 11:29
· 53 commits to main since this release
421ef35

Fix Space in ENV

    // Read the environment file and parse its contents into an associative array
    private function readEnvFile($envFilePath)
    {
        $envData = array(); // Initialize an empty array to store the environment data
        $file = fopen($envFilePath, "r"); // Open the environment file for reading
        if ($file) {
            while (($line = fgets($file)) !== false) {
                // Ignore lines starting with # or empty lines
                if (preg_match("/^\s*(#|$)/", $line)) {
                    continue;
                }
                // Parse lines in the format KEY=VALUE
                if (preg_match("/^([^=]+)=(.*)$/", $line, $matches)) {
                    $key = trim($matches[1]);
                    $value = trim($matches[2], "\" \n\r\t");
                    $envData[$key] = $value; // Store the key-value pair in the $envData array
                }
            }
            fclose($file); // Close the environment file
        }
        return $envData; // Return the parsed environment data
    }