Join Jon Peck for an in-depth discussion in this video What are CodeIgniter libraries?, part of Up and Running with PHP CodeIgniter (2013).
- View Offline
In computer science, a library is a collection of functionality that serves a…specific purpose with a well defined interface and logical structure.…CodeIgniter comes with several dozen libraries for common tasks.…Each implemented as a class. Examples of classes include the input…class, form validation class and HTML table class.…To use a library, it needs to be initialized within a controller using the…following initialization method: this -> load ->library, followed by a string…containing the machine name of the library.…
For example, form_validation. Multiple libraries can be initialized at…once by passing an array of strings containing the names of the libraries to load.…Such as form validation and table. Each library has a dedicated page within…the CodeIgniter User Guide, which includes usage examples and a function reference.…In this chapter, I'm going to allow users to add magazines using a form, then…validate those forms including some custom validation.…After that, I'll use a number of CodeIgniter libraries to accept user input…
Starting with the what and why of CodeIgniter, Jon introduces key concepts such as the MVC pattern and libraries by demonstrating how to create static pages, then storing and displaying magazine info in a database. Advanced topics like classes and helpers are explored to validate user input, upload files, and much more. By creating a complete system, you'll have the foundation to build your own applications with CodeIgniter.
- What is CodeIgniter?
- Creating a static page controller
- Generating output with a view
- What is a model?
- Saving data with Active Records
- Creating forms
- Validating user input
- Listing records in tables
- Uploading images
- Viewing and deleting records