_bootstrap.php 523 B

12345678910111213141516171819202122232425
  1. <?php
  2. declare(strict_types=1);
  3. $root = dirname(__DIR__, 2);
  4. $autoload = $root . '/vendor/autoload.php';
  5. if (is_file($autoload)) {
  6. require $autoload;
  7. }
  8. spl_autoload_register(function (string $class) use ($root): void {
  9. $prefix = 'AuditExpress\\';
  10. if (!str_starts_with($class, $prefix)) {
  11. return;
  12. }
  13. $relative = substr($class, strlen($prefix));
  14. $path = $root . '/src/' . str_replace('\\', '/', $relative) . '.php';
  15. if (is_file($path)) {
  16. require $path;
  17. }
  18. });
  19. return $root;