Skip to content

Internals Awt_src Functions Awt_autoLoader

Stefan Crkvenjakov edited this page Oct 7, 2026 · 1 revision

awt_src/functions/awt_autoLoader.fun.php

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/functions/awt_autoLoader.fun.php · Snapshot 8411f4287706.

Global helpers register autoloading and exception handlers or construct the application base URL from the request and settings.

Execution and global state

The script below is executed by its caller. Constants, registered callbacks, global assignments, guards, included files and their order are preserved here. Unlike class methods, entry-point execution can start the CLI loop, route a request, emit output, or terminate the process.

<?php
spl_autoload_register(/**
 * @throws Exception
 */ function ($classname): void {
    $class = str_replace('\\', DIRECTORY_SEPARATOR, $classname);
    if (file_exists(CLASSES . $class . '.php')) {
        include_once CLASSES . $class . '.php';
    } else if (file_exists(PACKAGES . $class . ".php")) {
        include_once PACKAGES . $class . '.php';
    } else {
        throw new Exception("Class $classname not found");
    }
});

Clone this wiki locally