agyanadda@gmail.com

CodeIgniter 4 Installation

CodeIgniter 4 Basics 1 min read Updated Dec 3, 2026 Topic 2 of 30

The recommended way to install CodeIgniter 4 is with Composer.

Requirements

  • PHP 8.1 or newer (check the CodeIgniter docs for the exact version your release needs)
  • PHP extensions intl and mbstring (on XAMPP, enable extension=intl in php.ini)
  • Composer
  • MySQL / MariaDB (or another supported database)

Create a project

composer create-project codeigniter4/appstarter blog

Set up the environment

The project has a file named env. Copy it to .env and set:

  • CI_ENVIRONMENT = development — shows detailed errors while you build
  • app.baseURL = 'http://localhost:8080/'

Lines in .env start with # when disabled — remove the # to use them.

Run the app

php spark serve starts a development server at http://localhost:8080. You will see the CodeIgniter welcome page.

Using XAMPP or WAMP

You can also put the project in htdocs and open the public folder (http://localhost/blog/public/), but php spark serve is simpler while learning.

Example

Example — Create and run a project Bash
# 1. Create the project
composer create-project codeigniter4/appstarter blog
cd blog

# 2. Create your .env from the template
cp env .env          # Windows: copy env .env

# 3. In .env, remove the # and set:
# CI_ENVIRONMENT = development
# app.baseURL = 'http://localhost:8080/'

# 4. Start the development server
php spark serve
# CodeIgniter development server started on http://localhost:8080

Open http://localhost:8080 to see the welcome page. Press Ctrl+C in the terminal to stop the server.

Test Yourself With Exercises

Exercise 1 Multiple Choice

Which command creates a new CodeIgniter 4 project?

Exercise 2 True / False

You must rename or copy the env file to .env for its settings to be used.

Exercise 3 Fill in the Blank

Start the development server with: php spark ___

Frequently Asked Questions

Open your php.ini (for XAMPP: C:\xampp\php\php.ini), find ;extension=intl, remove the semicolon, save and restart Apache or your terminal. Run php -m to check that intl is listed.