Skip to content

Commit 8fbe686

Browse files
committed
class files casesensitive
Signed-off-by: Bruno Meilick <[email protected]>
1 parent f3388ab commit 8fbe686

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

classes/DotEnv.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace Bnomei;
4+
5+
class DotEnv
6+
{
7+
private static $envLoaded = false;
8+
public static function load()
9+
{
10+
if (!static::$envLoaded) {
11+
$dir = option('bnomei.dotenv.dir', kirby()->roots()->index());
12+
if ($dir && is_callable($dir)) {
13+
$dir = $dir();
14+
}
15+
$dotenv = new \Dotenv\Dotenv($dir);
16+
$dotenv->load();
17+
$require = \option('bnomei.dotenv.required');
18+
if ($require && is_array($require) && count($require) > 0) {
19+
$dotenv->required($require);
20+
// TODO: type check
21+
}
22+
}
23+
}
24+
25+
public static function getenv(string $env)
26+
{
27+
static::load();
28+
return \getenv($env);
29+
}
30+
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bnomei/kirby3-dotenv",
33
"type": "plugin",
4-
"version": "1.0.3",
4+
"version": "1.0.4",
55
"description": "Kirby 3 Plugin for environment variables from .env",
66
"license": "MIT",
77
"authors": [

0 commit comments

Comments
 (0)