__DIR__ . '/class/', 'Insallah' => __DIR__ . '/class/Insallah/', ]; $parts = explode('\\', $classname); $namespace = array_shift($parts); $classFile = array_pop($parts) . '.php'; if (!array_key_exists($namespace, $classMap)) { return; } $path = implode(DIRECTORY_SEPARATOR, $parts); $file = $classMap[$namespace] . $path . DIRECTORY_SEPARATOR . $classFile; if (!file_exists($file) && !class_exists($classname)) { return; } require_once $file; });