diff options
| author | Daniel Weipert <git@mail.dweipert.de> | 2026-02-19 14:52:15 +0100 |
|---|---|---|
| committer | Daniel Weipert <git@mail.dweipert.de> | 2026-02-19 14:52:15 +0100 |
| commit | aa908ab7bd03818a2cb1f9b4686034f08736d1cb (patch) | |
| tree | d677fece0783b9ffe629ef881d1913df23b11f8b /src/Config.php | |
Diffstat (limited to 'src/Config.php')
| -rw-r--r-- | src/Config.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Config.php b/src/Config.php new file mode 100644 index 0000000..06b32d0 --- /dev/null +++ b/src/Config.php @@ -0,0 +1,19 @@ +<?php + +namespace ERPHP; + +class Config +{ + public static function load(): void + { + $_ENV = array_replace_recursive( + $_ENV, + json_decode(file_get_contents(dirname(__DIR__) . "/config.json"), true) ?: [] + ); + } + + public static function get(string $key, mixed $default = null): mixed + { + return $_ENV[$key] ?? getenv($key) === false ? $default : getenv($key); + } +} |
