Update: 2026-05-03 17:32:57
This commit is contained in:
34
app/helpers/helpers.php
Normal file
34
app/helpers/helpers.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Global Helper Functions
|
||||
*/
|
||||
|
||||
if (!function_exists('env')) {
|
||||
function env(string $key, $default = null) {
|
||||
return $_ENV[$key] ?? $default;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('input')) {
|
||||
function input(string $key = null, $default = null) {
|
||||
static $inputData = null;
|
||||
if ($inputData === null) {
|
||||
$json = file_get_contents('php://input');
|
||||
$inputData = array_merge($_GET, $_POST, json_decode($json, true) ?? []);
|
||||
}
|
||||
|
||||
if ($key === null) return $inputData;
|
||||
return $inputData[$key] ?? $default;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('dd')) {
|
||||
function dd(...$vars) {
|
||||
foreach ($vars as $v) {
|
||||
echo "<pre>";
|
||||
var_dump($v);
|
||||
echo "</pre>";
|
||||
}
|
||||
die();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user