CodeIgniter Libraries
Libraries used to provide common functionality that you want to be accessed by different parts of your app. They help provide a single point of entry that makes it simple to maintain consistency in business rules. They’re ideally used for creating focused, single-responsibility classes, like Benchmarking, UserObject, Article, etc.
Libraries are not just a file that must contain stand-alone information that can be passed from project to project, though that is the traditional role in CodeIgniter applications. It’s just not the only use for libraries.
It is present in both the system and the application folder.
Again, this is a class. (Note: your own libraries are not automatically included in the CI super-object, so you need to call CI resources in a different way.)
Load it like this: $this->load->library(‘class_name’);
Use it like this: $this->class_name->mainpage();
Notes on syntax:
No need to extend a base class, or for a constructor function.
This is enough:
1 2 3 4 5 |
class class_name() { function mainpage() { //code here } } |
Conceptually: Intended to hold your own code to extend CI functionality, or to create site-specific functionality.
List of Codeiginter Libraries
(Source : https://www.codeigniter.com/userguide3/libraries/index.html)
- Benchmarking Class
- Caching Driver
- Calendaring Class
- Shopping Cart Class
- Config Class
- Email Class
- Encrypt Class
- Encryption Library
- File Uploading Class
- Form Validation
- FTP Class
- Image Manipulation Class
- Input Class
- Javascript Class
- Language Class
- Loader Class
- Migrations Class
- Output Class
- Pagination Class
- Template Parser Class
- Security Class
- Session Library
- HTML Table Class
- Trackback Class
- Typography Class
- Unit Testing Class
- URI Class
- User Agent Class
- XML-RPC and XML-RPC Server Classes
- Zip Encoding Class