In CodeIgniter drivers are a very special type of Library that has a parent class and its child classes. Child classes have the access to its parent class but not their siblings. It provides an elegant syntax in your controllers file for libraries.

It can found in the system/libraries/ directory.


If we want to use a driver we have to initialize it within a controller with this given method.
$this->load->driver('class_name');


Here class_name is the name of the driver class which we want to invoke.

How we can create our own drivers in CodeIgniter.
  • You can create your own driver folder in /application/libraries/
  • Create your_Your_Driver_name.php file in /application/libraries/Your_Driver
  • In /application/libraries/Your_Driver/drivers
    • Your_Driver_name_subclass_1.php
    • Your_Driver_name_subclass_2.php
BY Best Interview Question ON 13 Jan 2019