_bootstrap.php 632 B

123456789101112131415161718192021222324252627
  1. <?php
  2. declare(strict_types=1);
  3. $root = dirname(__DIR__);
  4. // Composer autoload (required for Dompdf + PSR-4 classes)
  5. $autoload = $root . '/vendor/autoload.php';
  6. if (is_file($autoload)) {
  7. require $autoload;
  8. }
  9. // Fallback (when dependencies aren't installed yet)
  10. spl_autoload_register(function (string $class) use ($root): void {
  11. $prefix = 'AuditExpress\\';
  12. if (!str_starts_with($class, $prefix)) {
  13. return;
  14. }
  15. $relative = substr($class, strlen($prefix));
  16. $path = $root . '/src/' . str_replace('\\', '/', $relative) . '.php';
  17. if (is_file($path)) {
  18. require $path;
  19. }
  20. });
  21. return $root;