JLoader
abstract class JLoader
Static class to handle loading of libraries.
Properties
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.
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-4 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, bool $force = true, bool $recurse = false)
deprecated
deprecated 4.3 will be removed in 6.0 Classes should be autoloaded. Use JLoader::registerPrefix() or JLoader::registerNamespace() to register an autoloader for your files.
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 array
getDeprecatedAliases()
Method to get the list of deprecated class aliases.
static bool
import(string $key, string $base = null)
deprecated
deprecated 4.3 will be removed in 6.0 Classes should be autoloaded. Use JLoader::registerPrefix() or JLoader::registerNamespace() to register an autoloader for your files.
Loads a class from specified directories.
static void
register(string $class, string $path, bool $force = true)
deprecated
deprecated 4.3 will be removed in 6.0 Classes should be autoloaded. Use JLoader::registerPrefix() or JLoader::registerNamespace() to register an autoloader for your files.
Directly register a class to the autoload list.
static void
registerPrefix(string $prefix, string $path, bool $reset = false, bool $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 bool
registerAlias(string $alias, string $original, string|bool $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, bool $reset = false, bool $prepend = false)
Register a namespace to the autoloader. When loaded, namespace paths are searched in a "last in, first out" order.
static void
setup(bool $enablePsr = true, bool $enablePrefixes = true, bool $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 bool
loadByPsr4(string $class)
deprecated
deprecated 4.3 will be removed in 6.0 Use JLoader::loadByPsr instead
Method to autoload classes that are namespaced to the PSR-4 standard.
static bool
loadByPsr(string $class)
Method to autoload classes that are namespaced to the PSR-4 standard.
static void
loadByAlias(string $class)
Method to autoload classes that have been aliased using the registerAlias method.