Autoload
extends AutoloadConfig
in package
------------------------------------------------------------------- AUTOLOADER CONFIGURATION -------------------------------------------------------------------
This file defines the namespaces and class maps so the Autoloader can find the files as needed.
NOTE: If you use an identical key in $psr4 or $classmap, then the values in this file will overwrite the framework's values.
Table of Contents
- $classmap : array<string, string>
- ------------------------------------------------------------------- Class Map ------------------------------------------------------------------- The class map provides a map of class names and their exact location on the drive. Classes loaded in this manner will have slightly faster performance because they will not have to be searched for within one or more directories as they would if they were being autoloaded through a namespace.
- $files : array<int, string>
- ------------------------------------------------------------------- Files ------------------------------------------------------------------- The files array provides a list of paths to __non-class__ files that will be autoloaded. This can be useful for bootstrap operations or for loading functions.
- $psr4 : array<string, string>
- ------------------------------------------------------------------- Namespaces ------------------------------------------------------------------- This maps the locations of any namespaces in your application to their location on the file system. These are used by the autoloader to locate files the first time they have been instantiated.
- $coreClassmap : array<string, string>
- ------------------------------------------------------------------- Class Map ------------------------------------------------------------------- The class map provides a map of class names and their exact location on the drive. Classes loaded in this manner will have slightly faster performance because they will not have to be searched for within one or more directories as they would if they were being autoloaded through a namespace.
- $coreFiles : array<int, string>
- ------------------------------------------------------------------- Core Files ------------------------------------------------------------------- List of files from the framework to be autoloaded early.
- $corePsr4 : array<string, string>
- ------------------------------------------------------------------- Namespaces ------------------------------------------------------------------- This maps the locations of any namespaces in your application to their location on the file system. These are used by the autoloader to locate files the first time they have been instantiated.
- __construct() : mixed
- Constructor.
Properties
$classmap
------------------------------------------------------------------- Class Map ------------------------------------------------------------------- The class map provides a map of class names and their exact location on the drive. Classes loaded in this manner will have slightly faster performance because they will not have to be searched for within one or more directories as they would if they were being autoloaded through a namespace.
public
array<string, string>
$classmap
= ['ApiAzimut' => APPPATH . 'Libraries/ApiAzimut.php']
Prototype:
$classmap = [
'MyClass' => '/path/to/class/file.php'
];
$files
------------------------------------------------------------------- Files ------------------------------------------------------------------- The files array provides a list of paths to __non-class__ files that will be autoloaded. This can be useful for bootstrap operations or for loading functions.
public
array<int, string>
$files
= []
Prototype:
$files = [
'/path/to/my/file.php',
];
$psr4
------------------------------------------------------------------- Namespaces ------------------------------------------------------------------- This maps the locations of any namespaces in your application to their location on the file system. These are used by the autoloader to locate files the first time they have been instantiated.
public
array<string, string>
$psr4
= [
APP_NAMESPACE => APPPATH,
// For custom app namespace
'Config' => APPPATH . 'Config',
]
The '/app' and '/system' directories are already mapped for you. you may change the name of the 'App' namespace if you wish, but this should be done prior to creating any namespaced classes, else you will need to modify all of those classes for this to work.
Prototype:
$psr4 = [
'CodeIgniter' => SYSTEMPATH,
'App' => APPPATH
];
$coreClassmap
------------------------------------------------------------------- Class Map ------------------------------------------------------------------- The class map provides a map of class names and their exact location on the drive. Classes loaded in this manner will have slightly faster performance because they will not have to be searched for within one or more directories as they would if they were being autoloaded through a namespace.
protected
array<string, string>
$coreClassmap
= ['Psr\Log\AbstractLogger' => SYSTEMPATH . 'ThirdParty/PSR/Log/AbstractLogger.php', 'Psr\Log\InvalidArgumentException' => SYSTEMPATH . 'ThirdParty/PSR/Log/InvalidArgumentException.php', 'Psr\Log\LoggerAwareInterface' => SYSTEMPATH . 'ThirdParty/PSR/Log/LoggerAwareInterface.php', 'Psr\Log\LoggerAwareTrait' => SYSTEMPATH . 'ThirdParty/PSR/Log/LoggerAwareTrait.php', 'Psr\Log\LoggerInterface' => SYSTEMPATH . 'ThirdParty/PSR/Log/LoggerInterface.php', 'Psr\Log\LoggerTrait' => SYSTEMPATH . 'ThirdParty/PSR/Log/LoggerTrait.php', 'Psr\Log\LogLevel' => SYSTEMPATH . 'ThirdParty/PSR/Log/LogLevel.php', 'Psr\Log\NullLogger' => SYSTEMPATH . 'ThirdParty/PSR/Log/NullLogger.php', 'Laminas\Escaper\Escaper' => SYSTEMPATH . 'ThirdParty/Escaper/Escaper.php']
$coreFiles
------------------------------------------------------------------- Core Files ------------------------------------------------------------------- List of files from the framework to be autoloaded early.
protected
array<int, string>
$coreFiles
= []
$corePsr4
------------------------------------------------------------------- Namespaces ------------------------------------------------------------------- This maps the locations of any namespaces in your application to their location on the file system. These are used by the autoloader to locate files the first time they have been instantiated.
protected
array<string, string>
$corePsr4
= ['CodeIgniter' => SYSTEMPATH, 'App' => APPPATH]
Do not change the name of the CodeIgniter namespace or your application will break.
Methods
__construct()
Constructor.
public
__construct() : mixed
Merge the built-in and developer-configured psr4 and classmap, with preference to the developer ones.