class Autoloader

This class offer SPL Autoloader for any PSR-4 namespace or for this library itself.

Methods

static void
registerPSR4(string $namespace, string $path)

Register an autoloader for a PSR-4 namespace, enabling fosr classes traits and interfaces in that namespace to be automatically loaded if they are not yet defined.

static void
selfRegister()

Register the Keruald OmniTools PSR-4 classes.

static string
getLibraryPath()

Gets the Keruald OmniTools library path.

Details

at line 24
static void registerPSR4(string $namespace, string $path)

Register an autoloader for a PSR-4 namespace, enabling fosr classes traits and interfaces in that namespace to be automatically loaded if they are not yet defined.

Parameters

string $namespace
string $path

Return Value

void

at line 50
static void selfRegister()

Register the Keruald OmniTools PSR-4 classes.

This method is convenient when you don't use Composer or any other mechanism.

For example if you've put the library in your includes/ directory:

use Keruald\OmniTools\Registration\Autoloader as KerualdLoader;

require_once "includes/omnitools/Registration/Autoloader.php";
KerualdLoader::selfRegister();

You don't need to use this method if you already use a PSR-4 compatible autoloader like Composer + require vendor/autoload.php.

Return Value

void

at line 67
static string getLibraryPath()

Gets the Keruald OmniTools library path.

The path matches a PSR-4 namespace for Keruald\OmniTools.

Return Value

string

The library path.