- Drivers are a special kind of Library that includes a parent category and any range of potential kid categories.
- Child categories have access to the parent category, however not their siblings.
- Drivers offer a chic syntax in your controllers for libraries that like or need to be attenuated into distinct categories.
- Drivers are found in the system/libraries/ directory, in their own sub-directory which is identically named to the parent library class.
- Also within that directory could be a directory named drivers, which contains all of the possible child class files.
To use a driver you may initialize it at intervals controller exploitation the subsequent data format method:
Where category name is that the name of the driving force category you would like to invoke.
For example, to load a driver named “Some_parent” you'd do this:
Methods of that category will then be invoked with:
How to create a Codeigniter Custom Driver?
Sample driver directory and file structure layout:
Note - so as to keep up compatibility on case-sensitive file systems, the Driver_name directory should be named within the format came back by ucfirst().
Note - The Driver library’s architecture is such that the subclasses don’t extend and therefore don’t inherit properties or methods of the main driver.