JLoader
class JLoader
Static class to handle loading of libraries.
Methods
Method to discover classes of a given type in a given path.
Method to get the list of registered classes and their respective file paths for the autoloader.
Method to get the list of deprecated class aliases.
Method to get the list of registered namespaces.
Loads a class from specified directories.
Load the file for a class.
Directly register a class to the autoload list.
Register a class prefix with lookup path. This will allow developers to register library packages with different class prefixes to the system autoloader. More than one lookup path may be registered for the same class prefix, but if this method is called with the reset flag set to true then any registered lookups for the given prefix will be overwritten with the current lookup path. When loaded, prefix paths are searched in a "last in, first out" order.
Offers the ability for "just in time" usage of class_alias()
.
Register a namespace to the autoloader. When loaded, namespace paths are searched in a "last in, first out" order.
Method to setup the autoloaders for the Joomla Platform.
Method to autoload classes that are namespaced to the PSR-4 standard.
Method to autoload classes that are namespaced to the PSR-0 standard.
Method to autoload classes that have been aliased using the registerAlias method.
Applies a class alias for an already loaded class, if a class alias was created for it.
Autoload a class based on name.
Details
static
void
discover(
string $classPrefix,
string $parentPath,
boolean $force = true,
boolean $recurse = false)
Method to discover classes of a given type in a given path.
static
array
getClassList()
Method to get the list of registered classes and their respective file paths for the autoloader.
static
void
register(
string $class,
string $path,
boolean $force = true)
Directly register a class to the autoload list.
static
void
registerPrefix(
string $prefix,
string $path,
boolean $reset = false,
boolean $prepend = false)
Register a class prefix with lookup path. This will allow developers to register library packages with different class prefixes to the system autoloader. More than one lookup path may be registered for the same class prefix, but if this method is called with the reset flag set to true then any registered lookups for the given prefix will be overwritten with the current lookup path. When loaded, prefix paths are searched in a "last in, first out" order.
static
boolean
registerAlias(
string $alias,
string $original,
string|boolean $version = false)
Offers the ability for "just in time" usage of class_alias()
.
You cannot overwrite an existing alias.
static
void
registerNamespace(
string $namespace,
string $path,
boolean $reset = false,
boolean $prepend = false,
string $type = 'psr0')
Register a namespace to the autoloader. When loaded, namespace paths are searched in a "last in, first out" order.
static
void
setup(
boolean $enablePsr = true,
boolean $enablePrefixes = true,
boolean $enableClasses = true)
Method to setup the autoloaders for the Joomla Platform.
Since the SPL autoloaders are called in a queue we will add our explicit class-registration based loader first, then fall back on the autoloader based on conventions. This will allow people to register a class in a specific location and override platform libraries as was previously possible.
static
boolean
loadByPsr4(
string $class)
Method to autoload classes that are namespaced to the PSR-4 standard.
static
boolean
loadByPsr0(
string $class)
Method to autoload classes that are namespaced to the PSR-0 standard.
static
boolean
loadByAlias(
string $class)
Method to autoload classes that have been aliased using the registerAlias method.