The fundamental piece of a CodeIgniter system is its libraries. It gives a rich arrangement of libraries, which in a roundabout way speed up building up an application. The framework library is situated at framework/libraries. We should simply to stack the library that we need to utilize. The library can be stacked as appeared underneath −
$this->load->library('class name');
Where class name is the name of the library that we need to stack. On the off chance that we need to stack numerous libraries, at that point we can essentially pass a cluster as contention to library() work as appeared beneath −
$this->load->library(array('email', 'table'));
Library Classes
The library classes are situated in framework/libraries. Each class has different capacities to improve the creating work. Following table shows the names of the library class and its depiction.
Given underneath are the most generally utilized Library Classes.
S.N. Library Class and Description
1
Benchmarking Class
Benchmarking class is constantly dynamic, empowering the time contrast between any two checked focuses to be determined.
2
Storing Class
This class will store the pages, to rapidly get to the page speed.
3
Calendaring Class
Utilizing this class, you can progressively make schedules.
4
Shopping basket Class
Utilizing this class, you can include or expel thing from Shopping Cart. The things are spared in meeting and will stay dynamic until the client is perusing the site.
5
Config Class
Setup inclinations can be recovered, utilizing this class. This class is introduced naturally.
6
Email Class
This class gives email related usefulness, as send or answer to email.
7
Encryption Class
This class gives two-way information encryption usefulness.
8
Document Uploading Class
This class gives functionalities identified with document transferring. You can set different inclinations like sort of record to be transferred, size of the documents and so on.
9
Structure Validation Class
This class gives different capacities to approve structure.
10
FTP Class
This class gives different FTP related capacities like moving documents to expel server, moving, renaming or erasing records on server.
11
Picture Manipulation Class
Control of picture like resize, thumbnail creation, trimming, pivoting, watermarking should be possible with the assistance of this class.
12
Info Class
This class pre-forms the info information for security reason.
13
Language Class
This class is utilized for internationalization.
14
Loader Class
This class loads components like View records, Drivers, Helpers, Models and so forth.
15
Movements Class
This class gives functionalities identified with database movements.
16
Yield Class
This class sends the yield to program and furthermore, reserves that site page.
17
Pagination Class
This class adds pagination functionalities to site page.
18
Layout Parser Class
The Template Parser Class can perform straightforward content substitution for pseudo-factors contained inside your view documents. It can parse straightforward factors or variable label sets.
19
Security Class
This class contains security related capacities like XSS Filtering, CSRF and so forth.
20
Meeting Library
This class gives functionalities to keep up meeting of your application.
21
HTML Table
This class is utilized to auto-produce HTML tables from cluster or database results.
22
Trackback Class
The Trackback Class gives works that empower you to send and get Trackback information.
23
Typography Class
The Typography Class gives strategies that help to arrange content.
24
Unit Testing Class
This class gives functionalities to unit test your application and create the outcome.
25
URI Class
The URI Class gives techniques that assist you with recovering data from your URI strings. On the off chance that you use URI directing, you can likewise recover data about the rerouted fragments.
26
Client Agent Class
The User Agent Class gives works that help distinguish data about the program, cell phone, or robot visiting your site. Likewise, you can get referrer data just as language and upheld character-set data.
27
XML-RPC and XML-RPC Server Classes
CodeIgniter's XML-RPC classes license you to send solicitations to another server, or set up your own XML-RPC server to get demands.
28
Zip Encoding Class
This class is utilized to make compress documents of your information.
Creating Libraries
CodeIgniter has rich arrangement of libraries, which you can discover in framework/libraries organizer yet CodeIgniter isn't simply constrained to framework libraries, you can make your own libraries as well, which can be put away in application/libraries envelope. You can make libraries in three different ways.
- Make new library
- Broaden the local library
- Supplant the local library
Create New Library
While making new library one should remember, the accompanying things −
- The name of the record must beginning with a capital letter for example Mylibrary.php
- The class name must beginning with a capital letter for example class Mylibrary
- The name of the class and name of the record must match.
Mylibrary.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Mylibrary {
public function some_function() {
}
}
/* End of file Mylibrary.php */
Stacking the Custom Library
The above library can be stacked by basically executing the accompanying line in your controller.
$this->load->library(‘mylibrary’);
mylibrary is the name of your library and you can compose it in lowercase just as capitalized letters. Utilize the name of the library without ".php" augmentation. Subsequent to stacking the library, you can likewise call the capacity of that class as demonstrated as follows.
$this->mylibrary->some_function();
Extend the Native Library
Now and again, you may need to add your own usefulness to the library gave by CodeIgniter. CodeIgniter gives office by which you can expand the local library and include your own capacities. To accomplish this, you should broaden the class of local library class. For instance on the off chance that you need to expand the Email library, at that point it tends to be done as appeared beneath −
Class MY_Email extends CI_Email {
}
Here, in the above model, MY_Email class is broadening the local library's email class CI_Email. This library can be stacked by the standard method for stacking email library. Spare the above code in document My_Email.php
Replace the Native Library
In certain circumstances, you would prefer not to utilize the local library the manner in which it works and need to supplant it with your own particular manner. This should be possible by supplanting the local library. To accomplish this, you simply need to give a similar class name as it is named in local library. For instance, in the event that you need to supplant the Email class, at that point utilize the code as demonstrated as follows. Spare your document name with Email.php and give a class name to CI_Email.
Email.php
Class CI_Email {
}