← Back to Command Library

CodeIgniter

CodeIgniter 4 Install and First Run

Install CI4, prepare env, migrate schema, and start server.

Practical starter command set for CodeIgniter 4.

Version

CodeIgniter 4.7+

Tags

codeigniter4,php,migration,seeder

Views

57

Problem

Wrong order of env and migration steps can cause first-run runtime errors.

Solution Summary

Use this setup order for a stable CI4 local environment.

Step 1

composer create-project codeigniter4/appstarter ci4app
Note: Install CI4 appstarter.

Step 2

cd ci4app
Note: Enter the project folder.

Step 3

copy env .env
Note: Enable environment configuration file.

Step 4

php spark key:generate
Note: Generate encryption key.

Step 5

php spark migrate
Note: Run all migrations.

Step 6

php spark db:seed CommandLibrarySeeder
Note: Insert sample command library records.

Step 7

php spark serve
Note: Start local server at localhost:8080.