You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
448 B

2 months ago
<?php
namespace Kirby\Kql;
use Kirby\Toolkit\Str;
function autoload(string $namespace, string $dir)
{
spl_autoload_register(function ($class) use ($namespace, $dir) {
if (str_contains($class, '.') === true || str_starts_with($class, $namespace) === false) {
return;
}
$path = Str::after($class, $namespace);
$path = $dir . '/' . str_replace('\\', '/', $path) . '.php';
if (is_file($path) === true) {
include $path;
}
});
}