Installation
Relevant source files
The following files were used as context for generating this wiki page:
This document provides a comprehensive guide to installing the CodeIgniter 4 framework. CodeIgniter 4 is a lightweight, fast, and flexible PHP web framework. Proper installation is the first step to building an application. This guide covers server requirements, the two primary installation methods (Composer and manual), and instructions for running the application locally.
The installation process is designed to be straightforward, with the recommended approach utilizing Composer for dependency management. This ensures that your application has all the necessary components and can be easily updated. For those who prefer not to use Composer initially, a manual installation option is also available.
Server Requirements
Before installing CodeIgniter 4, ensure your server meets the following requirements. The framework performs a check and will exit with an error message if the intl extension is missing.
Sources: source/installation/requirements.rst:3-8
| Requirement | Version/Extension - |
|---|---|
| PHP | Version 7.4 or newer. - |
| PHP Extensions | intl, json, mbstring, mysqlnd, xml, curl - |
| Supported Databases | MySQL (5.1+), PostgreSQL, SQLite3, MSSQL. - |
Sources: source/installation/requirements.rst:10-27
Installation via Composer (Recommended)
Using Composer is the recommended way to install CodeIgniter 4. It simplifies dependency management and future upgrades. This method downloads the codeigniter4/appstarter package and its dependencies.
Sources: source/installation/installing_composer.rst:3-10
The following diagram illustrates the Composer installation workflow.
This diagram shows the automated steps Composer takes to set up a new CodeIgniter 4 project.
Sources: source/installation/installing_composer.rst:22-23
To create a new project, run the following command in your terminal:
composer create-project codeigniter4/appstarter project-root
Replace project-root with the desired name for your application's directory.
Sources: source/installation/installing_composer.rst:22-23
Manual Installation
For users who prefer not to use Composer, a manual installation is possible by downloading a zip file of the latest release from the official website.
Sources: source/installation/installing_manual.rst:3-5
The manual installation process is outlined below.
This diagram shows that even with a manual download, Composer is required to install the necessary vendor packages.
Sources: source/installation/installing_manual.rst:3-15
After extracting the files, you must install the dependencies, including the CodeIgniter 4 framework itself, using Composer. Navigate to your project root and run:
composer install
This command will download all required third-party libraries into the vendor directory.
Sources: source/installation/installing_manual.rst:14-15
Running the Application
Once installed, you can run the application using CodeIgniter's local development server. This is ideal for development purposes as it doesn't require configuration of a full web server like Apache or Nginx.
Sources: source/installation/running.rst:3-6
Navigate to your project's root directory and start the server with the following command:
php spark serve
This will start a web server on http://localhost:8080. You can view your application by visiting this URL in your web browser.
Sources: source/installation/running.rst:11-14
Upgrading Your Application
If you installed CodeIgniter via Composer, upgrading to a new version is straightforward.
Sources: source/installation/upgrading.rst:3-4
You can update the framework by running the update command:
composer update
This will check for newer versions of codeigniter4/framework and other dependencies as allowed by your composer.json file and install them. It is recommended to review the Upgrading section of the User Guide for any potential breaking changes before updating.
Sources: source/installation/upgrading.rst:22-27
Project Repository
This user guide is generated from the main CodeIgniter 4 development repository. The repository at zhgabor/ci4_userguide is a read-only mirror used for publishing the guide. Any contributions or issue reports for the user guide should be directed to the main codeigniter4/codeigniter4 repository.
Sources: README.md:7-11