3.4. CodeIgniter Libraries

CodeIgniter libraries help you do your job faster and more efficiently. Each library is really a PHP class with various methods that you can use once the library is loaded by a controller. Some classes are so useful and so ubiquitous that you might as well autoload them (such as the database and session libraries).

CodeIgniter includes the following libraries:

  • Benchmarking — The Benchmarking library is always active. Use it to determine the time difference between any two marked points in code and to calculate memory usage.

  • Calendaring — The Calendaring library must be loaded by a controller. Use it to dynamically create calendars for given months and years, with some control over formatting and appearance.

  • Config — The Config library is initialized automatically by the system. Use it to retrieve configuration information.

  • Database — The Database library is a very powerful set of methods that must be loaded. You'll be using this library so much that the next subsection of this chapter focuses on it exclusively.

  • Email — The Email library must be loaded. It includes a very powerful set of tools that simplifies the job of sending e-mails.

  • Encryption — The Encryption library must be loaded. It provides you with powerful two-way encryption methods.

  • File Uploading — The File Uploading library must be loaded. Use this library whenever you need to handle file uploads. It includes powerful validation features that can restrict a file by mime type, size (in kilobytes), ...

Get Professional CodeIgniter® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.