Files
testprojekt/rss/php/autoload.php

22 lines
500 B
PHP
Raw Permalink Normal View History

2026-04-06 16:49:17 -04:00
<?php
declare(strict_types=1);
spl_autoload_register(function (string $class): void {
$root = rtrim($_SERVER['DOCUMENT_ROOT'], '/');
// PSR-4-ish:
$prefix = 'Vor\\';
$baseDir = $root . '/rss/php/classes/';
if (strncmp($class, $prefix, strlen($prefix)) !== 0) {
return;
}
$relative = substr($class, strlen($prefix));
$file = $baseDir . str_replace('\\', '/', $relative) . '.php';
if (is_file($file)) {
require_once $file;
}
}, true, true);