Skip to content

Commit 61111e8

Browse files
committed
feat: add readEnv function
Signed-off-by: Teakowa Gatanothor O'deorain <hub+git@teakowa.dev>
1 parent 0d271c6 commit 61111e8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/helpers.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,18 @@ function fpe(string $key, string $cipher = 'aes-256-cbc', int $round = 7): Crypt
205205
return new Cryptomute($cipher, $key, $round);
206206
}
207207
}
208+
209+
if (!function_exists('readEnv')) {
210+
/**
211+
* 读取env.
212+
*
213+
* @param string $name
214+
* @param $default
215+
*
216+
* @return array|false|mixed|string
217+
*/
218+
function readEnv(string $name, $default = null): mixed
219+
{
220+
return getenv($name) ?: env($name, $default);
221+
}
222+
}

0 commit comments

Comments
 (0)