CodeIgniter

CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you're a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you're tired of ponderously large and thoroughly undocumented frameworks, then CodeIgniter might be a good fit.

Why CodeIgniter?

  • Small footprint — The entire framework package is under 2MB, including documentation.
  • Simple and elegant — CodeIgniter uses the MVC (Model-View-Controller) pattern, which separates logic from presentation.
  • Fast — Compared to other PHP frameworks, CodeIgniter is consistently one of the fastest.
  • Nearly zero configuration — Most of CodeIgniter works out of the box. The only file you may need to modify is the main config file.
  • Excellent documentation — Clear, thorough documentation and a friendly community.

MVC Architecture

CodeIgniter is based on the Model-View-Controller development pattern:

  • Model — Represents your data structures. Model classes contain functions that help you retrieve, insert, and update database information.
  • View — The information that is being presented to a user. A view file is normally a web page, but in CodeIgniter, a view can also be a page fragment, a header, footer, etc.
  • Controller — The controller serves as an intermediary between the Model, the View, and any other resources needed to process an HTTP request and generate a web page.

A Basic Controller Example

<?php
class Hello extends CI_Controller {

    public function index()
    {
        $this->load->view('hello_world');
    }
}
?>

A Basic View Example

<html>
<head>
    <title>My First CodeIgniter Page</title>
</head>
<body>
    <h1>Hello World!</h1>
</body>
</html>

Explore our PHP tutorials from the homepage to start building with PHP and CodeIgniter.