How to install CodeIgniter 4 in XAMPP (Windows 10)

by Jairon Landa




In this tutorial I will show you how to setup CodeIgniter 4 using composer and run it in XAMPP.

If you still do not have XAMPP and Composer. Please download and install XAMPP and Composer in your machine.

 

Before we start, please check PHP.ini to make sure the intl extension is enabled.

Remove semicolon (;) to enable the extension.

;extension=intl to extension=intl

 

Installation and Setup

Navigate: C:\xampp\htdocs\

Enter command:

composer create-project codeigniter4/appstarter --no-dev

Note: This command will not install phpunit and composer dependencies

no-dev – Only framework and trusted dependencies being composer install.

The command will create appstarter folder. You can rename whatever you want. In this tutorial I rename the appstarter to mysite-project

 

Update/Upgrading

Navigate mysite-project folder, enter command:

composer update

 

Setup Virtual Host

Navigate: C:\xampp\apache\conf\extra\

Open httpd-vhosts.conf file.

Paste the following snippet to httpd-vhosts.conf file and save it.

Restart XAMPP Apache to take effect the configuration.

 

Configure Hosts file

Next, edit Hosts file. To permit ci4site.test run in browser.

Open Notepad.exe (Run as Administrator).

Select File > Open and navigate Windows > System32 > drivers > etc

Open the hosts file and add 127.0.01 ci4site.test line at the bottom host file and save the host file.

Example:

Example host file

 

Validating installation

Open browser and check http://ci4site.test

It should show like this

ci 4 welcome

 

Conclusion

You learn how to setup CodeIgniter 4 with composer and configure host file to set local domain and run project in XAMPP.

About Jairon Landa (@jaironlanda)
Jairon Landa

Backend and Frontend developer, a.k.a full-stack developer.

Kg Bundung, Tuaran

Recommended Posts