Ivantha
Ivantha

Reputation: 521

Different ways of loading libraries in CodeIgniter

What is the difference of loading a library in CodeIgniter via,

  1. autoload.php
  2. Controller class

Is there any point in loading the library in the constructor method of the controller class as,

$this->load->library(array('form_validation'));

when I can just load them at the autoload.php?

Thank you!

Upvotes: 0

Views: 262

Answers (1)

AnatPort
AnatPort

Reputation: 748

Not loading all libraries in autoload is simply for performance reasons. If you rarely use a certain library, you might want to load it only when using it's relevant controller. Autoloading every library all the time could be "wasteful".

Upvotes: 2

Related Questions