Initial Kaffeekasse SaaS restart

This commit is contained in:
2026-06-15 17:13:38 +02:00
commit b08eb93547
54 changed files with 4617 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace App\Core;
final class Env
{
public static function load(string $file): void
{
if (!is_file($file)) {
return;
}
$lines = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: [];
foreach ($lines as $line) {
$trimmed = trim($line);
if ($trimmed === '' || str_starts_with($trimmed, '#')) {
continue;
}
[$name, $value] = array_pad(explode('=', $trimmed, 2), 2, '');
$name = trim($name);
$value = trim($value);
if ($value !== '' && ($value[0] === '"' || $value[0] === '\'')) {
$value = trim($value, "\"'");
}
$_ENV[$name] = $value;
$_SERVER[$name] = $value;
}
}
}