Setup codeigniter on local machine

Hello World, This is first tutorial of  learn codeigniter from scratch series. In this tutorial we will learn that how we can setup codeigniter on our local machine. After set up, we will create simple hello world application. I have divided this tutorial in following parts:

  • Introduction of MVC
  • Introduction of Codeigniter
  • Setup Codeigniter on local machine

Introduction of MVC

MVC is a design pattern of programming field. According to wikipedia MVC is,

Model–view–controller (MVC) is an architectural pattern commonly used for developing user interfaces that divides an application into three interconnected parts. This is done to separate internal representations of information from the ways information is presented to and accepted from the user. The MVC design pattern decouples these major components allowing for efficient code reuse and parallel development.

Graphic representation of MVC is

mvc structure

Introduction of Codeigniter

Codeigniter is one of best framework (according to me) in php world. According to wikipedia definition:

CodeIgniter is loosely based on the popular model–view–controller (MVC) development pattern. While controller classes are a necessary part of development under CodeIgniter, models and views are optional.

You can read more about codeigniter on their official documentation.

Setup Codeigniter on local machine

In this step we will setup codeigniter on our xamp server.

  • Download codeigniter from their official website.
  • You will get the zip file. Extract the zip file in htdocs docs folder.
  • Rename this folder to todo.
  • Open the app in browser with following url structure.




The above screen is User Guide Tutorial. This is default tutorial of codeigniter. You can learn everything about codeigniter from this guide. It shows us that we have successfully installed codeigniter on our local machine.

Hello world app with codeigniter

Now its time to create Hello world app in codeigniter.

  • Open todo/application/controllers/welcome.php file and replace the code with following code.
defined('BASEPATH') OR exit('No direct script access allowed');

class Welcome extends CI_Controller {
	public function index()
		echo "Hello World";
  • When you refresh the page, You will the Hello World Message.

Congratulation, You have settled up codeigniter and created Hello World App.

In the next tutorial we will create static website with codeigniter and Bootstrap 3. In the Next tutorial we will utilise the Controllers and Views. I hope you will enjoy this series.

Leave a Reply

Your email address will not be published. Required fields are marked *