Is using Includes in Codeigniter autoload good practice?

Asked

Viewed 45 times

0

I have a project that uses autoload to load several libraries, Helpers, using several include_once. As Inputs, Forms etc.

Some are used on multiple controllers, others not so much. Would it be good practice to load all on autoload or is it better to load on demand? Would you overload the server if this is done on autoload? Thank you very much!

  • My tip: use the function spl_autoload_register

1 answer

1


I don’t think so.

Basically what autoload does is load the class/functions to the Codeigniter instance.

If by chance I have a helper that helps me with invoices, I carry it only where it will be used. However, if I use a template engine class that I will use in all views, I leave it loaded directly in autoload.

An alternative is to use Poser autoload.

Read on: Auto-loading Resources - Codeigniter

Browser other questions tagged

You are not signed in. Login or sign up in order to post.