How to Install/Download CodeIgniter Using Composer

How to Install/Download CodeIgniter Using Composer

Codeigniter tutorial – In this article, We would love to share with how to install & download codeigniter project using the composer. In this tutorial, We will install the codeigniter project and run the downloaded project.

You will also learn how to remove index.php in url using the htaccess file. We will create a new .htaccess file in root directory of project and write some code for removing the index.php in url.

We would love to share with you some basic configuration of codeigniter project. After successfully download the codeigniter fresh setup, we need to some basic configuration of codeigniter project.


  • How to install Composer
  • Check Composer
  • Create Codeigniter Project
  • CodeIgniter Config Files
  • Configurations
  • Setup Database Credential
  • Run the project
  • Important Note
  • Conclusion

How to install Composer

Go to the browser and hit the following URL in your browser

Download composer and follow the setup of installation.

Check Composer

Open the command prompt/terminal


Create Codeigniter Project

Now open your command prompt and run the following command for creating a codeigniter project name “online-code”.

composer create-project CodeIgniter/framework online-code

After run the above command in command prompt, it will create a project with required files.

CodeIgniter Config Files

We have successfully installed CodeIgniter project, let’s see the configuration directory. Go to application/config file and see.

codeigniter director structure


Next we will set the some basic configuration on config.php file, so let’s go to application/config/config.php and open this file on text editor.

Set Base URL

$config['base_url'] = '';

like this

$config['base_url'] = 'http://localhost:3000';

$config[‘base_url’] = ‘http://localhost:3000’; sets the base URL to localhost running on port 3000.

Setup Database Credential

Next step, we will connect the download project with database, so go to application/database.php and setup the database credential here.

$db['default'] = array(
	'dsn'	=> '',
	'hostname' => 'localhost',
	'username' => 'root',
	'password' => 'root',
	'database' => 'online-code',
	'dbdriver' => 'mysqli',
	'dbprefix' => '',
	'pconnect' => FALSE,
	'db_debug' => (ENVIRONMENT !== 'production'),
	'cache_on' => FALSE,
	'cachedir' => '',
	'char_set' => 'utf8',
	'dbcollat' => 'utf8_general_ci',
	'swap_pre' => '',
	'encrypt' => FALSE,
	'compress' => FALSE,
	'stricton' => FALSE,
	'failover' => array(),
	'save_queries' => TRUE

Run the project

Next we will run download project, let’s open the terminal so go to

cd C:\Xampp\htdocs\online-code

Run the following command

php -S localhost:3000

After run the above command, go to browser and hit url http://localhost:3000/

Important Note

Remove index.php Using .htaccess

go to application/config, Open the file config.php. Find and Replace the below code in config.php file.

//  Find the below code
$config['index_page'] = "index.php"
// Remove index.php
$config['index_page'] = ""

Create .htaccess File

Go to your CodeIgniter root folder and create .htaccess file.

.htaccess <--------- like this

Write Code in .htaccess file

 RewriteEngine on
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]


In this codeigniter tutorial – we have successfully install or download the codeigniter project using the composer and learn here some basic configuration of codeigniter project. We have also remove index.php in url using .htaccess file.


My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

One reply to How to Install/Download CodeIgniter Using Composer

  1. Thanks a Lot.I am New To Codeigniter. This tutorial has been solved my Big Problem. Thank U Thnak U soo Much

Leave a Reply

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