CodeIgniter: PHP MVC Framework

CodeIgniter: PHP MVC Framework

July 13, 2020
CodeIgniter | PHP MVC framework For Web Application Development

CodeIgniter is a powerful PHP based web development framework, built for developers who need to create a simple and elegant web applications. CI was created by EllisLab.

The goal of CI is to enable you to develop web application much faster than you could if you were writing code from scratch in PHP, by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries. CI lets you creatively focus on your project by minimizing the amount of code needed for a given task.

Why CodeIgniter?

  • Free
  • Light Weight
  • Fast
  • MVC (Model-View-Controller)
  • Generates Clean URLs
  • Does Not Require a Template Engine

PHP code

<ul>
<?php foreach ($addressbook as $name):?>
        <li><?=$name?></li>
<?php endforeach; ?>
</ul>

 Pseudo-code used by a template engine

<ul>
{foreach from=$addressbook item="name"}
        <li>{$name}</li>
{/foreach}
</ul>

Application Flow Chart

Codeignitor Application Flow Chart

CodeIgniter MVC (Model View Controller)

The Model-View-Controller is software development pattern that separates application logic from presentation. In practice, it permits your web pages to contain minimal scripting since the presentation is separate from the PHP scripting.

Model

The Model represents your data structures. Typically your model classes will contain functions that help you retrieve, insert, and update information in your database.

View

The View is the information that is being presented to a user. A View will normally be a web page, but in CodeIgniter, a view can also be a page fragment like a header or footer. It can also be an RSS page, or any other type of page.

Controller

The Controller serves as an intermediary between the Model, the View, and any other resources needed to process the HTTP request and generate a web page.

CodeIgniter has a fairly loose approach to MVC since Models are not required. If you don’t need the added separation, or find that maintaining models requires more complexity than you want, you can ignore them and build your application minimally using Controllers and Views. CodeIgniter also enables you to incorporate your own existing scripts, or even develop core libraries for the system, enabling you to work in a way that makes the most sense to you.

Leave A Comment