What are Libraries in CodeIgniter?

Why Interviewers Ask This

This is a classic screening question for CodeIgniter roles. Hiring managers ask it early in interviews to gauge your baseline understanding and determine if you can communicate technical concepts clearly.

Answer

Libraries in CodeIgniter (especially CI3) are classes that provide functionality beyond what helpers offer. In CI3, you load them with $this->load->library("email") then use $this->email->send(). Common built-in libraries: Email (send emails), Upload (file uploads), Session (session management), Encryption (encrypt/decrypt), Pagination, Form_validation, Image_lib (image manipulation), Cart (shopping cart), Cache. In CodeIgniter 4, the concept of libraries changed — functionality is now accessed through services: $email = \Config\Services::email() or service("email"). You can also create custom libraries in app/Libraries/.

Pro Tip

This topic has CodeIgniter-specific nuances that differ from general programming. Highlighting those nuances in your answer shows expertise rather than generic knowledge.