Using Codeigniter for PHP application development

By: Benny Alexander Emailed: 1608 times Printed: 2078 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.

Simplicity

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()
{
parent::Controller();
}

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">
<tr>
<td><b>User Name</b></td>
<td><b>Email</b></td>
</tr>
<?
if(is_array($users)) {
foreach($users as $key => $value) {
?>
<tr>
<td><? echo $value['username']?></td>
<td><? echo $value['email']?></td>
</tr>
<?
}
else {
?>
<tr><td colspan="2">No users found</td></tr>
<?
}
}
?>
</table>

The output comes as below:

User Name

Email Id

Daniel

daniel@gmail.com

James

james@yahoo.com

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: http://www.macronimous.com/resources/using_codeigniter_for_PHP_application_development.asp)


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

Comments(0)


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
Different versions of PHP - History and evolution of PHP
Traversing Arrays Using foreach in PHP
The new keyword and constructors in PHP
public, protected, and private Properties in PHP
parent:: AND self:: in PHP
preg_split() and explode() in PHP
Using Codeigniter for PHP application development
Parent: child process exited with status 3221225477 -- Restarting
Building a Video Sharing Site using PHP in AWS
Get the next working day in PHP
The Object (compound) Type in PHP
History and origin of PHP
Getting Started with PHP
.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
Most Emailed Articles (in PHP)
preg_split() and explode() in PHP
Exception in module wampmanager.exe at 000F15A0 in Windows 8
preg_match(), function preg_match_all(), preg_grep() in PHP
Where does the PHP run?
Cannot load /usr/local/apache/libexec/libphp4.so into server: ld.so.1:......
Password must include both numeric and alphabetic characters - Magento
PHP code to import from CSV file to MySQL
PHP code to write to a CSV file from MySQL query
History and origin of PHP
Convert XML to CSV in PHP
Different versions of PHP - History and evolution of PHP
public, protected, and private Methods in PHP
Handling BLOB in PHP and MySQL
Parent: child process exited with status 3221225477 -- Restarting
Installing PHP 5.x with Apache 2.x on HP UX 11i and configuring PHP 5.x with Oracle 9i