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?


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 

Stack Overlode is optimized Tutorials and examples for learning and training. Examples might be simplified to improve reading and learning and understand. Tutorials and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using Stack Overlode, you agree to have read and accepted our terms of use, cookie and privacy policy.