How to spl_autoload_register multiple directories for same namespace

I have an existing autoload, which goes through json file to autoload different 3rd party files, this works really well. However there are new files being added to project and they are in different directories but using the same namespace. Issue is that it seems only to load the last directory for the same namespace, so when it goes to load the file it can’t find it.

I figured that would need to put the directories into an array and loop through that, but I am unsure how to go about that in PHP code.

Current PHP Code

spl_autoload_register(function (string $class_name): void {
    // Get mappings from json
    $conductor = file_get_contents(__DIR__.'/autoload.json');
    $conductor = str_replace('\', '\\', $conductor);
    $configuration = json_decode(stripslashes($conductor), true);

    // Map the namespace to the corresponding folder
    $namespace_mapping = $configuration['autoload']['psr-4'];
 
    foreach ($namespace_mapping as $namespace => $directory) {
        if (
            strpos($class_name, $namespace = trim($namespace, '\')) !== 0
            || (!$directory = realpath(__DIR__ . DIRECTORY_SEPARATOR . trim($directory, DIRECTORY_SEPARATOR)))
        ) {
            continue; // Class name doesn't match or the directory doesn't exist
        }
 
        // Require the file
        $class_file = $directory . str_replace([$namespace, '\'], ['', DIRECTORY_SEPARATOR], $class_name) . '.php';
        if (file_exists($class_file)) {
            require_once $class_file;
        }
    }
});

Current Json

{
    "autoload": {
        "psr-4": {
            "Psr\Log\": "psr/log/src/",
            "Psr\Http\Server\": "psr/http-server-handler/src/",
            "Psr\Http\Server\": "psr/http-server-middleware/src/",
            "Psr\Http\Message\": "psr/http-message/src/",
            "Psr\Http\Message\": "psr/http-factory/src/",
            "Psr\Container\": "psr/container/src/"
        }
    }
}

I was thinking needing to do something like this in json:

"Psr\Http\Server\": ["psr/http-server-handler/src/", "psr/http-server-middleware/src/"],

Any assistance would be greatly appreciated.