Codeigniter Auto-load Resources
ADVERTISEMENTS
CodeIgniter comes with AN “Auto-load” feature that allows libraries, helpers, and models to be initialized mechanically anytime the system runs.
If you would like bound resources globally throughout your application you must think about auto-loading them for convenience.
- The following items can be loaded automatically:
- Classes found in the libraries/ directory
- Helper files found in the helpers/ directory
- Custom config files found within the config/ directory
- Language files found in the system/language/ directory
- Models found in the models/ folder
To autoload resources, open the application/config/autoload.php file and add the item you want to be loaded to the autoload array.
You’ll realize directions in this file similar to every form of item.
Note - don't embody the file extension (.php) once adding things to the autoload array.