CodeIgniter 4 requires PHP version 7.2 or higher. The earlier version requires a minimum PHP 5.3 version or higher.
There is now a public directory like in other frameworks. You can now separate the application from the resources (like CSS, JS, files.).
It is much more difficult for attackers.
In this tutorial, I show how you can install the Codeigniter 4 project on Windows and Mac.
1. Enable extensions
php.inifile to enable
- Search extension in the file.
- Remove semicolon (;) if exists to enable the extension.
- Restart the server.
2. Manual Installation
- Download CodeIgniter 4 zip file from here.
- Copy in the
htdocs/folder and extract it.
- Rename the folder (e.g. codeigniter4).
3. Using composer
- Navigate to
htdocs/using Command Prompt if you are on Windows and use the terminal if you are on Mac.
- Run the following command –
composer create-project codeigniter4/appstarter project-root
- Replace project-root with your project name like – codeigniter4.
- If you are getting the following message on the Command prompt while running –
- It means
intlextension is not been enabled.
- To enable the extension follow the step 1.
- Re-run the
composer create-project codeigniter4/appstarter project-root.
- A new codeigniter4 folder will be created.
- Run the project
- On Mac in case, you are not viewing the above page instead following page display –
- Then need to change the permission of the
- Navigate to the project directory using the terminal and execute the following command and refresh the page.
chmod -R 777 writable
Local Development Server
- You can also run the project by starting a local development server.
- Run the following command in the Command Prompt if you are on Windows or on the terminal if you are on Mac.
php spark serve
- Development URL display after starting.
- Run – http://localhost:8080/ in the browser.
You can either install it using a composer or manually. Before installing make sure that the PHP version is 7.2 or higher.If you found this tutorial helpful then don't forget to share.