public static
|
#
discover( string $classPrefix, string $parentPath, boolean $force = true, boolean $recurse = false )
Method to discover classes of a given type in a given path.
Method to discover classes of a given type in a given path.
Parameters
- $classPrefix
string - $classPrefix The class name prefix to use for discovery.
- $parentPath
string - $parentPath Full path to the parent folder for the classes to discover.
- $force
boolean - $force True to overwrite the autoload path value for the class if it already
exists.
- $recurse
boolean - $recurse Recurse through all child directories as well as the parent path.
Since
11.1
|
public static
array
|
#
getClassList( )
Method to get the list of registered classes and their respective file paths
for the autoloader.
Method to get the list of registered classes and their respective file paths
for the autoloader.
Returns
array - The array of class => path values for the autoloader.
Since
11.1
|
public static
array
|
#
getDeprecatedAliases( )
Method to get the list of deprecated class aliases.
Method to get the list of deprecated class aliases.
Returns
array - An associative array with deprecated class alias data.
Since
3.6.3
|
public static
array
|
#
getNamespaces( string $type = 'psr0' )
Method to get the list of registered namespaces.
Method to get the list of registered namespaces.
Parameters
- $type
string - $type Defines the type of namespace, can be prs0 or psr4.
Returns
array - The array of namespace => path values for the autoloader.
Since
12.3
|
public static
boolean
|
#
import( string $key, string $base = null )
Loads a class from specified directories.
Loads a class from specified directories.
Parameters
- $key
string - $key The class name to look for (dot notation).
- $base
string - $base Search this directory for the class.
Returns
boolean - True on success.
Since
11.1
|
public static
boolean
|
#
load( string $class )
Load the file for a class.
Load the file for a class.
Parameters
- $class
string - $class The class to be loaded.
Returns
boolean - True on success
Since
11.1
|
public static
|
#
register( string $class, string $path, boolean $force = true )
Directly register a class to the autoload list.
Directly register a class to the autoload list.
Parameters
- $class
string - $class The class name to register.
- $path
string - $path Full path to the file that holds the class to register.
- $force
boolean - $force True to overwrite the autoload path value for the class if it already
exists.
Since
11.1
|
public static
|
#
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.
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.
Parameters
- $prefix
string - $prefix The class prefix to register.
- $path
string - $path Absolute file path to the library root where classes with the given prefix
can be found.
- $reset
boolean - $reset True to reset the prefix with only the given lookup path.
- $prepend
boolean - $prepend If true, push the path to the beginning of the prefix lookup paths
array.
Throws
Since
12.1
|
public 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.
Offers the ability for "just in time" usage of class_alias() .
You cannot overwrite an existing alias.
Parameters
- $alias
string - $alias The alias name to register.
- $original
string - $original The original class to alias.
- $version
string|boolean - $version The version in which the alias will no longer be present.
Returns
boolean - True if registration was successful. False if the alias already exists.
Since
3.2
|
public static
|
#
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.
Register a namespace to the autoloader. When loaded, namespace paths are
searched in a "last in, first out" order.
Parameters
- $namespace
string - $namespace A case sensitive Namespace to register.
- $path
string - $path A case sensitive absolute file path to the library root where classes of
the given namespace can be found.
- $reset
boolean - $reset True to reset the namespace with only the given lookup path.
- $prepend
boolean - $prepend If true, push the path to the beginning of the namespace lookup paths
array.
- $type
string - $type Defines the type of namespace, can be prs0 or psr4.
Throws
Since
12.3
Note
The default argument of $type will be changed in J4 to be 'psr4'
|
public static
|
#
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.
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.
Parameters
- $enablePsr
boolean - $enablePsr True to enable autoloading based on PSR-0.
- $enablePrefixes
boolean - $enablePrefixes True to enable prefix based class loading (needed to auto load
the Joomla core).
- $enableClasses
boolean - $enableClasses True to enable class map based class loading (needed to auto load
the Joomla core).
Since
12.3
|
public static
boolean
|
#
loadByPsr4( string $class )
Method to autoload classes that are namespaced to the PSR-4 standard.
Method to autoload classes that are namespaced to the PSR-4 standard.
Parameters
- $class
string - $class The fully qualified class name to autoload.
Returns
boolean - True on success, false otherwise.
Since
3.7.0
|
public static
boolean
|
#
loadByPsr0( string $class )
Method to autoload classes that are namespaced to the PSR-0 standard.
Method to autoload classes that are namespaced to the PSR-0 standard.
Deprecated
4.0 this method will be removed
Parameters
- $class
string - $class The fully qualified class name to autoload.
Returns
boolean - True on success, false otherwise.
Since
13.1
|
public static
boolean
|
#
loadByAlias( string $class )
Method to autoload classes that have been aliased using the registerAlias
method.
Method to autoload classes that have been aliased using the registerAlias
method.
Parameters
- $class
string - $class The fully qualified class name to autoload.
Returns
boolean - True on success, false otherwise.
Since
3.2
|
public static
|
#
applyAliasFor( string $class )
Applies a class alias for an already loaded class, if a class alias was
created for it.
Applies a class alias for an already loaded class, if a class alias was
created for it.
Parameters
- $class
string - $class We'll look for and register aliases for this (real) class name
Since
3.4
|
public static
boolean
|
#
_autoload( string $class )
Autoload a class based on name.
Autoload a class based on name.
Parameters
- $class
string - $class The class to be loaded.
Returns
boolean - True if the class was loaded, false otherwise.
Since
11.3
|