Add MySQL schema dump for phpMyAdmin
This commit is contained in:
19
bootstrap/autoload.php
Normal file
19
bootstrap/autoload.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
spl_autoload_register(function (string $class): void {
|
||||
$prefix = 'App\\';
|
||||
$baseDir = __DIR__ . '/../app/';
|
||||
|
||||
$len = strlen($prefix);
|
||||
if (strncmp($prefix, $class, $len) !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$relativeClass = substr($class, $len);
|
||||
$file = $baseDir . str_replace('\\', '/', $relativeClass) . '.php';
|
||||
|
||||
if (file_exists($file)) {
|
||||
require $file;
|
||||
}
|
||||
});
|
||||
|
||||
require_once __DIR__ . '/helpers.php';
|
||||
29
bootstrap/helpers.php
Normal file
29
bootstrap/helpers.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use App\Core\Config;
|
||||
|
||||
if (!function_exists('config')) {
|
||||
function config(string $key, $default = null)
|
||||
{
|
||||
return Config::getInstance()->get($key, $default);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('env')) {
|
||||
function env(string $key, $default = null)
|
||||
{
|
||||
$value = $_ENV[$key] ?? $_SERVER[$key] ?? getenv($key);
|
||||
if ($value === false || $value === null) {
|
||||
return $default;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('base_path')) {
|
||||
function base_path(string $path = ''): string
|
||||
{
|
||||
$base = realpath(__DIR__ . '/..');
|
||||
return $path ? $base . '/' . ltrim($path, '/') : $base;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user