Using Codeigniter for PHP application development

By: Benny Alexander Emailed: 1728 times Printed: 2329 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

With many software frameworks available online nowadays, with many pros and cons on their side, it has become very important to check out complete details of these frameworks before applying them. Amongst the various kinds of software frameworks, the PHP Framework is more popular nowadays. Being simple to work on and easy to use, PHP frameworks are soon becoming the catchword of software frameworks

There are many advantages of using PHP frameworks:

  • Applications can be built quickly and easily
  • Simple to debug
  • Secured
  • Easy to install and use
  • Good for applications utilizing multiple platforms

CodeIgniter (CI)

One of the effective PHP Frameworks is the CodeIgniter. Web applications with advanced features can be readied using the CodeIgniter. Simpler for the beginners, CI follows an MVC (Model View Controller) pattern, thereby enabling in easy learning. Also, due to the usage of conventional PHP coding, the existing codes can be ported using this PHP framework. Also the simplicity with which it works and the speed that it has when compared to the other frameworks, is definitely considerable

Striking features of CodeIgniter

There are many features that are quite distinguishing, in CI. Few of the most important features are explained below:

User Guide

One of the most important features of the CodeIgniter is that it has a very impressive user guide. The way the documentation has been done is simply marvelous and highly useful for coders to know more about the working.


CodeIgniter is simple and a major portion of the work gets completed in the controllers and uploading the libraries. Since the workings are clear and open, it is very easy to understand what is happening and therefore, simple to use.

Model Handling

While working with models, CodeIgniter uses a straight way of handling. Standard SQL queries can be mimed using few simple commands. Also creation of model objects, loading it and introducing methods to deal with a customized task is also possible.

Data Validation

Data validation is a major thing while working on models. Here a validation class is used to validate data. First, few rules are defined and assigned to the object to be validated. The data that is sent through the URL is automatically validated by the validation object. Even certain error messages can also be automated the same way, using data validation class.

There are many other advantages of using CI:

  • Migration from one server to another is easier and hassle-free. Also installation is easier as well.
  • CI is very easy to handle and also to customize. In case a new functionality has to be applied, it can be done without affecting the customization.
  • With MVC based framework, it offers flexibility and easy management
  • Active Record Implementation is simply superb and easy to remember.
  • Configuration and customization of these configuration files are also easy, thus facilitating easy working with various types of developers.
  • The collection of libraries that it posses is also good enough.
  • And as previously said, awesome documentation of the user guide, which makes any coder easy to use the whole framework.

Given below is a simple example to display user information from database. Using CodeIgniter, the programmer and designer can simultaneously work on the same project, without having to wait for each other to complete their parts. Here the first part “Create a controller named user.php and store it in Controllers folder” is prepared by the programmer, and the second part “Create a view named user.php and store it in views folder” is prepared by the designers simultaneously.

# Create a controller named user.php and store it in Controllers folder

class User extends Controller {
function User()

function view() {
$this->load->database(); # This line is not needed if database library is put into autoload
$query = $this->db->query("SELECT username, email FROM tbl_users");
if($query->num_rows() >0) {
foreach($query->result_array() as $row) {
$users[] = $row;

$data['users'] = $users;

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

# Create a view named user.php and store it in views folder

<table border="0" cellspacing="1" cellpadding="5">
<td><b>User Name</b></td>
if(is_array($users)) {
foreach($users as $key => $value) {
<td><? echo $value['username']?></td>
<td><? echo $value['email']?></td>
else {
<tr><td colspan="2">No users found</td></tr>

The output comes as below:

User Name

Email Id



So, if you are looking for a PHP Framework with exceptional performance, compatible with any standard hosting services along with various versions of PHP and with any template language, almost nil configuration hassles, does not ask you to follow rigid coding rules and crystal-clear user guide and documentation; then you are referring to the CodeIgniter PHP Framework 

Submitted by: Benny Alexander (Url:

PHP Home | All PHP Tutorials | Latest PHP Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.

Bookmark and Share


Be the first one to add a comment

Your name (required):

Your email(required, will not be shown to the public):

Your sites URL (optional):

Your comments:

More Tutorials by Benny Alexander
Using Codeigniter for PHP application development

More Tutorials in PHP
PHP code to import from CSV file to MySQL
PHP code to write to a CSV file from MySQL query
PHP code to write to a CSV file for Microsoft Applications
Convert XML to CSV in PHP
Password must include both numeric and alphabetic characters - Magento
PHP file upload (Large Files)
PHP file upload prompts authentication for anonymous users
PHP file upload with IIS on windows XP/2000 etc
Error: Length parameter must be greater than 0
Multiple File Upload in PHP using IFRAME
Resume or Pause File Uploads in PHP
Exception in module wampmanager.exe at 000F15A0 in Windows 8
Handling file locks in PHP
HTML table output using Nested for loops in PHP
Count occurrences of a character in a String in PHP

More Latest News
Most Viewed Articles (in PHP )
isset() function in PHP
Parent: child process exited with status 3221225477 -- Restarting
A Basic Example using PHP in AWS (Amazon Web Services)
Different versions of PHP - History and evolution of PHP
preg_replace() and preg_replace_callback() in PHP
public, protected, and private Properties in PHP
Using Cookies in PHP
Handling BLOB in PHP and MySQL
Renaming and Removing Files in PHP
Reading word by word from a file in PHP
Reading and Writing .gz files in PHP
Upload and Download files with FTP in PHP
Installing PHP 5.x with Apache 2.x on HP UX 11i and configuring PHP 5.x with Oracle 9i
Installing PHP with nginx-server under windows
Function to return number of digits of an integer in PHP
Most Emailed Articles (in PHP)
.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
Different versions of PHP - History and evolution of PHP
The new keyword and constructors in PHP
public, protected, and private Methods in PHP
preg_replace() and preg_replace_callback() in PHP
Iterating Through an Array in PHP
Appending One Array to Another in PHP
Decrypting files using GnuPG (GPG) via PHP
Setting up PHP in Windows 2003 Server IIS7, and WinXP 64
Running different websites on different versions of PHP in Windows 2003 & IIS6 platform
Warning: session_start(): open .... failed - PHP error
Malware: global $ob_starting;
Function to convert strings to strict booleans in PHP
Function to sort array by elements and count of element in PHP
Error: Length parameter must be greater than 0