basic website, basic templating

This commit is contained in:
2022-10-21 14:31:48 +02:00
parent 303fc11327
commit fdd24d90da
11 changed files with 196 additions and 0 deletions

18
src/bootstrap.php Normal file

@ -0,0 +1,18 @@
<?php
spl_autoload_register(callback: function($className) {
$prefix = 'App';
$baseDir = __DIR__;
$len = strlen(string: $prefix);
if (strncmp(string1: $prefix, string2: $className, length: $len) !== 0) {
return;
}
$realClassName = substr(string: $className, offset: $len);
$classLocation = $baseDir . str_replace(search: '\\', replace: '/', subject: $realClassName) . '.php';
if (file_exists(filename: $classLocation)) {
require $classLocation;
} else {
die("Invalid class: $className");
}
});