Course Content
Introduction to CodeIgniter
CodeIgniter is a powerful PHP framework built for developers who need a simple and elegant toolkit to create full-featured web applications.
MVC (Model-View-Controller)
MVC stands for Model-View-Controller. MVC is an application design model consisting of three interconnected parts. They include the model (data), the view (user interface), and the controller (processes that handle input).
The Session class allows you to maintain a user’s "state" and track their activity while they browse your site.
URI Routing
There is a one-to-one relationship between a URL string and its corresponding controller class/method. The segments in a URI normally follow this pattern:
Forms and Input
Forms provide a way for users to interact with the application and submit data.
Composer is dependency manager in PHP. it allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
You can enable CSRF protection by modifying your application/config/config.php file
Working with Database
Like any other framework, we need to interact with the database very often and CodeIgniter makes this job easy for us. It provides a rich set of functionalities to interact with the database.
DataTables is a table enhancing plug-in for the jQuery Javascript library that helps in adding sorting, paging, and filtering abilities to plain HTML tables with minimal effort. The main goal is to enhance the accessibility of data in normal HTML tables.
PhpSpreadsheet is a PHP library for reading and writing spreadsheet files. Importing Excel and CSV into MySQL help to save the user time and avoid repetitive work.
Payment Gateway
Razorpay and PayTM Payment Gateway
WhatsApp Chatbot and Telegram Chatbot
CodeIgniter 3
About Lesson

A Model is responsible for managing the data of the application. It receives user input from the Controller. It can contain functions to insert, update, and retrieve your application data.

Model classes reside in the application/models/ directory. They can be nested within sub-directories.

The basic syntax for the model is:

class Model_name extends CI_Model {



Let’s see the following example for a better understanding of the model:


class Blog_model extends CI_Model {

	public function add() {
		$data = [
			‘title’		=> ‘Title’,
			‘description’	=> ‘Description’
		// insert(‘table_name‘, ‘array_of_object’)
		$this->db->insert(‘blog_info’, $data);

	public function get_blog_list() {
		$query = $this->db->get(‘blo_info’);
		return $query->result();


A file name must match the class name and the first letter of the Model class must be a capital letter.


Load a Model

this->load->model() method is used to load a model.

The basic syntax is as follows:



If your model is located in a sub-directory, include the relative path from your model’s directory. For example, if you have a model located at application/models/user/Profile.php you’ll load it using:



Once the model is loaded, you can access all the public methods using an object with the same name as your class:



Here is an example of a controller, that loads a model, then serves a view:

class Blog extends CI_Controller {

	public function index() {

        $data[‘list’] = $this->blog_model->get_blog_list();

        $this->load->view('about_us', $data);