In this tutorial you will learn about the Codeigniter 4 Installation and its application with practical example.
In this CodeIgniter 4 Installation tutorial, I’ll show you how to install codeigniter 4 for your web project development. Codeigniter 4 can be installed in following different ways:
- Codeigniter 4 Manual Installation
- Codeigniter 4 Composer Installation
- Codeigniter 4 Installation using Git
Codeigniter 4 Manual Installation
In this section I’ll show you how to install Codeigniter 4 Manually. Go to Codeigniter’s official website and download and extract Codeigniter’s new setup and your local webserver environment.
Codeigniter 4 Composer Installation
In this section I’ll show you how to install Codeigniter 4 Using Composer. Here are the steps to download & install Composer in CodeIgniter:
Step 1) Open the following URL in your browser https://getcomposer.org/download/. Download the setup and follow the installation instructions.
Step 2) Open the command prompt/terminal and run the following command to check the composer is installed or not.
1 |
composer |
Congratulations, you have successfully installed the composer.
Step 3) Let’s create a new Codeigniter 4 Project called myFirstProject. Run the following command:
1 |
composer create-project codeigniter4/appstarter myFirstProject -s rc |
Note:- The above command will run after Codeigniter 4 latest version is successfully installed.
Codeigniter 4 Installation using Git
In this section I’ll show you how to install Codeigniter 4 using Git. if you want to install or download Codeigniter 4 using Git. Then you can download and install codeigniter 4 using the git repository. Use the following command to download and install codeigniter 4 from the git repository:
1 |
git remote add upstream https://github.com/codeigniter4/CodeIgniter4.git |
Run Codeigniter 4 Project
Now, we will run the downloaded project. Let’s open the terminal and switch to your project folder:
1 |
cd C:\Xampp\htdocs\myFirstProject |
Now, run the project using following command:
1 2 3 4 5 6 7 8 9 |
php spark serve OR php spark serve --port=8081 OR php -S localhost:3000 |
Now, visit the following link in the browser to see the output –
http://localhost:8000/ or http://localhost:8081/ or http://localhost:3000/