From 3a30abc05ea688c827c02f0396368e57683a2898 Mon Sep 17 00:00:00 2001 From: greggy Date: Fri, 22 May 2026 19:19:28 +0000 Subject: [PATCH] fix: replace custom autoloader with composer PSR-4 autoloader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The custom autoloader used lowercase directory names which broke after renaming app/core/ → app/Core/ and app/controllers/ → app/Controllers/ for PSR-4 compliance. --- public/index.php | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) mode change 100644 => 100755 public/index.php diff --git a/public/index.php b/public/index.php old mode 100644 new mode 100755 index 005abcc..e343151 --- a/public/index.php +++ b/public/index.php @@ -7,28 +7,8 @@ declare(strict_types=1); * All requests are routed through this file. */ -// Autoloader (PSR-4 style, simple) -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); - // Lowercase directory names, keep class name case - $parts = explode('\\', $relativeClass); - $className = array_pop($parts); - $parts = array_map('strtolower', $parts); - $parts[] = $className; - $file = $baseDir . implode('/', $parts) . '.php'; - - if (file_exists($file)) { - require $file; - } -}); +// Autoloader (composer PSR-4) +require_once __DIR__ . '/../vendor/autoload.php'; use App\Core\Router;