Jet\Autoloader

This main class covers everything. It registers the autoloaders and takes care of the actual logic of loading the classes.

Overview of methods

Method Meaning of
public static register(
Autoloader_Loader $loader
): void
Registers Autoloader.
public static initialize(
): void
Initializes the autoloader system.
public static registerLibraryAutoloaders(
?string $dir=null
) : void
Registers library autoadders.

Using the optional $dir parameter, you can specify an optional library directory. If not defined, the value from system configuration is automatically used.
public static registerApplicationAutoloaders(
?string $dir=null
) : void
Registers the application autoloaders.

Using the optional $dir parameter it is possible to specify an optional directory of application autoloaders. If not defined, the value from system configuration is automatically used.
public static initComposerAutoloader(
) : void
Initializes the Composer autoloader.
public static load(
string $class_name
): void
The main method that does the actual loading of the class (and also the cache operations).

You don't have to call the method manually, of course, that happens automatically.
public static getScriptPath(
string $class_name,
?string &$loader_name=''
) : string|bool
A helper method that does not load the class, but only determines where it should be found.

The &$loader_name parameter is a reference. That is, if you need to know which loader determined the class location, you can use this parameter.

The return value is the path to the script that should contain the class based on the autoloaders, or false if the path cannot be determined.
Previous chapter
Jet\Autoloader_Cache_Backend_Files
Next chapter
Jet\Autoloader_Loader