Codeigniter Library
The main part of a CodeIgniter framework is its libraries.It provides a collection of libraries,which indirectly increase the speed of developing an application.The library can be manually loaded as shown below example -
$this->load->library('library name');
If we want to manually load multiple libraries , then we can simply pass an array as argument to library() function as shown below example?
$this->load->library(array('session','email'));
The library can be auto loaded as shown below example -
First to auto load the library Application / config / autoload.php
$autoload['libraries'] = array('session','email');
Creating Libraries
While creating new CodeIgniter library one should keep in mind, the following steps ?
- The name of the file must start with a capital letter e.g. Testinglibrary.php
- The class name must should be started with a capital letter and file name and class name should be same e.g. class Testinglibrary
The library is shown as below example -
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
class Testinglibrary {
//Creat some functions here
}