CodeIgniter Chat example

How to creating and integrate gmail, facebook like chat system to the CodeIgniter system or web site.In this article is describing step by step how to integrate simple chat process into the CodeIgniter.

CodeIgniter Chat example Features

  • Multiple chatting
  • Using JQuery Ajax
  • Display notifications by changing colors
  • Displays Sent time after 3 minutes of inactivity
  • Basically similar to Gmail, Facebook like chat box
  • Auto-resize of text input box
  • Minimize and close chat boxes

Browser Compatibility

1. Firefox 2+
2. Chrome
3. Internet Explorer 6+
4. Safari 2+
5. Opera 9+

CodeIgniter Facebook like ajax Live Chat Plugin Version 2

CodeIgniter Facebook like ajax Live Chat Plugin Version 2

How to create chat process


1-First install fresh codeigniter into your localhost or web server.You can learn how to install codeigniter by it’s official web site.
2-Open the config file(application/config/config.php) and put your server and database details there.
Also need to as TRUE.

And coockie path ,


1-Go to the phpmyadmin, run this tables there.
chat table

users table

Download full database from here.


1-Download this chat.js Javascript file and keep it in the script folder named as js(application/js).
Open that file and replace your site url instead of the “http://localhost/CodeIgniter/”.There are 4 places.
Download chat.js file from here.
2-Also you need to put these jquery.js files there.
3-Then download these 3 css files and keep those in the css folder(application/css).
Download css files(3 KB)
File structure.
CodeIgniter-chat css files


1-Create a file to display online users.I’m do this,
-application/views/chat/userList.php (view file)
userList.php file structure

-application/controllers/chat.php (controller file)
chat.php controller file structure

2-Download this chat.php file to process the chat, and put it in the application/views/chat/
Download chat.php file from here.

Open that file and put the server, database details there and save it.

3-Go to the model folder and create file named users_model.php

My file structure like this.
codeigniter chat example folder_structure


Chat by Chris:
Chat by Sumith

Chat history saved in the table

chat history
That’s only.
View CodeIgniter Chat example Demo

Go to the new page and wait 5 seconds, then click “SKIP AD” button of the top right corner.Then you can view demo.

Full source code containing with users login and logout process.

Download Full CodeIgniter Chat Example(2.6 MiB)

Want this freebie? Enter your email and get it now!

Simply enter your email address and the download link will be sent right to your inbox.