CodeIgniter Autoload – what is CodeIgniter Autoload

CodeIgniter Autoload – what is CodeIgniter Autoload

CodeIgniter Autoload :: comes with an “Autoload” feature that include libraries, helpers, models and others to be initialized automatically every time when system is runs. If we need certain globally resources throughout your application, then we should consider “Autoload” them for convenience.

To CodeIgniter Autoload resources, open file application/config/autoload.phpand add item that we want to loadede in autoload array.

  • Important Points Of Autoload Concept
  • Libraries
  • Config
  • Helper
  • Model
  • Language
  • Sample autoload.php configuration
  • Important Points Of Autoload Concept

CodeIgniter Autoload file specifies which systems should be loaded by default(it self).
If we say it in other words, The files initialized automatically every time the system runs(default).

  • Every now and again utilized frameworks ought to be autoload rather than called at the neighborhood level repeatedly.
  • Used to keep the system as light-weight
  • On the off chance that your application needs worldwide asset, make it autoload
  • For instance, the database is not associated with consequently since no presumption is made in regards to whether you plan to utilize it. This document lets you comprehensively characterize which frameworks you might want stacked with each request.

These are the things you can load CodeIgniter Autoload:

  1. Libraries
  2. Custom config files
  3. Helper files
  4. Models
  5. Language files

Libraries CodeIgniter

These are the classes situated in the ‘application/libraries' organizer or in your application/libraries folder. $autoload alternative 'libraries' is a rundown of libraries that ought to be stacked. eg.database, session, email, frame approvals and so forth.

// libraries
$autoload['libraries'] = array();

Helper CodeIgniter

These are classes located in the folder ‘application/helper’ . $autoload option ‘helper’ is a list of helper collections that we will need to get work done. eg. form, URL, text helpers etc.

// helper
$autoload['helper'] = array();

Config CodeIgniter

These are the classes located in folder ‘config’. This item is intended for use ONLY if you have created custom config files. Otherwise, leave it blank.

// config
$autoload['config'] = array();

Language CodeIgniter

These are the classes located in the ‘system/language’ folder.

// language
$autoload['language'] = array();

Model CodeIgniter

These are the classes located in the ‘models’ folder. $autoload option ‘model’ allows you to autoload models.

// model
$autoload['model'] = array();

Sample autoload.php configuration for CodeIgniter Autoload

// libraries
$autoload['libraries'] = array('database','session','email','validation');
// helper
$autoload['helper'] = array('url','form','text','date','security');
// model
$autoload['model'] = array();
// config
$autoload['config'] = array();

You also like codeigniter select query and codeigniter join tables and Codeigniter Delete Query

Leave a Comment

Your email address will not be published. Required fields are marked *

23  +    =  30

We accept paid advance and paid guest Posting on our Site : Contact US