How to Install CodeIgniter 4: Step-by-Step Guide (2025)

In 2025, PHP remains a relevant and widely used programming language. CodeIgniter remains one of the most used web development frameworks. In this tutorial, we will guide you through the installation and setup of a CodeIgniter 4 application step by step.

This is the simplest and most beginner-friendly explanation for installing and running CodeIgniter. I’ll guide you from scratch to a fully set-up environment, based on real experience. And as we all know—experience is valuable. You might not realize it, but you are about to start learning one of the most efficient frameworks. It is ideal for building web applications. CodeIgniter is lightweight, fast, and ideal for projects with a limited budget. It also opens up excellent job opportunities for beginners.

So, let’s begin this exciting journey with CodeIgniter 4 installation!

CodeIgniter 4 Installation & Environment Setup

In CodeIgniter 4, We have two ways to install: one is manual download, and the other is help with composer. Using the composer install keeps it always up to date. If you want manual installation, you have to go the CodeIgniter 4 official site and download from there.

Step 1: CodeIgniter 4 Installation & Environment Setup
install CodeIgniter 4 using Composer.

Method 1: Install CodeIgniter 4 manually

To manually install CodeIgniter 4, go to the official website: https://codeigniter.com and download the latest version.
Once downloaded, extract the files into your web server directory (e.g., htdocs or www).
Running the project is the same as with the command-line installation — open your terminal, navigate to the project folder, and start the development server using:

php spark serve

Then, open your browser and go to:

http://localhost:8080

Download Composer Installer:

Method 2: Install CodeIgniter 4 via Composer


🧰 Step 1: Download Composer Installer

  1. Open your browser and go to the official Composer website:
    👉 https://getcomposer.org
  2. Scroll down and click on “Getting Started” or visit this direct link:
    👉 https://getcomposer.org/download
  3. Under Windows Installer, click “Composer-Setup.exe” to download the .exe file.

💾 Step 2: Install Composer (Windows Installer)

  1. After the installer is downloaded, open it.
     In Chrome, it’s at the bottom-left of the browser.
  2. The Composer Setup window will open.

🧭 Step 3: Installation Process

📌 Install Mode:

  • You’ll see two options:
    • 🔘 Install for all users (Recommended)
    • 🔘 Install for the current user only
      Select the first option and click Next.

📌 Developer Mode (Optional):

  • If you see the developer mode checkbox, you can leave it unchecked (or check if you’re a developer).
    ✅ Click Next.

📌 PHP Path Setup:

  • You will be prompted to choose the path to the PHP executable.
    • Find the file: C:\xampp\php\php.exe
    • If automatically detected, otherwise click on Browse, go to C:\xampp\php, and select php.exe
      ✅ Click Next.

📌 Proxy Settings:

  • Leave the proxy settings as-is (default).
    ✅ Click Next.

📌 Ready to Install:

  • You’ll see a summary window saying, “Ready to Install”.
    ✅ Click Install.

Step 4: Wait for Installation

  • Wait a few moments while Composer is installed.

✅ Click Finish.

Step 5: Verify Composer Installation

  1. Open Command Prompt:
    • Windows: Windows + R, type cmd, and hit Enter.
    • macOS/Linux: Open Terminal from Applications or using Ctrl + Alt + T.
composer --version

if the composer is install successfully, it will so like this

Composer version 2.8.8 2025-04-04 16:56:46
PHP version 8.0.30 (C:\xampp\php\php.exe)

Then open the device terminal or use the IDE terminal; in my case I use the VS Code editor. Go to Your htdocs Folder (if you’re using XAMPP)

  1. Open your terminal
  2. Navigate to your web server root directory (e.g., htdocs in XAMPP):
  3. cd /Applications/XAMPP/htdocs
  4. Run the command to install CodeIgniter 4:
composer create-project codeigniter4/appstarter my_ci4_project

cd C:\xampp\htdocs

Step 2: Launch Your CodeIgniter Project

my_ci4_project is the folder name for your CodeIgniter app. You can change it.

Run This Composer Command to Install CodeIgniter 4

It will take a few minutes to download and install. Wait patiently and take a deep breath. Look at the terminal. You will feel comfort when the installation is happening. It looks very great.

composer create-project codeigniter4/appstarter my_ci4_project

Go Inside the Project Folder

cd my_ci4_project

Start the Built-in PHP Server (for quick testing)

php spark serve

Then open your browser and go to: http://localhost:8080

codeingtor-welcome-page

And that’s it! You’ve just successfully installed CodeIgniter 4. It doesn’t matter if you’re a beginner or brushing up your skills. Getting the installation right is the first big step. From here, you can start building dynamic and powerful CodeIgniter applications.

Remember , every expert was once a beginner—so take your time, experiment, practice, and enjoy the learning process. If this guide was useful, please do not hesitate to leave a comment or share with your fellow programmers. Happy coding, and see you in the next tutorial! This time just code code or code ! 🚀💻

What is CodeIgniter 4?

CodeIgniter 4 is a light PHP framework used for constructing web applications with less configuration. It provides faster performance, a more organized code structure, and supports the latest PHP versions. It also includes built-in advanced security features.

What PHP version is required for CodeIgniter 4?

CodeIgniter 4 requires PHP version 7.4 or higher. PHP 8.0+ is recommended for best performance, compatibility, and security purposes.

What is php spark serve used for?

php spark serve is a command used to start a local development server provided by CodeIgniter 4. It allows you to run the app on http://localhost:8080 without configuring Apache or Nginx.

Where do I put the CodeIgniter 4 project if I’m using XAMPP?

Put the project folder into C:\xampp\htdocs\ (for Windows) or /Applications/XAMPP/htdocs/ (for macOS). Then open it using http://localhost:8080 after executing php spark serve.

I’m getting a “PHP executable not found” error during Composer install.

Make sure the PHP path (e.g., C:\xampp\php\php.exe) is properly selected during Composer installation. You may also manually include this path in your system’s environment variables.

Leave a Comment

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