We will Configure our Codeigniter 4 that we have installed already. I will show you how to configuration database connection details, base url and project environment in Codeigniter 4.
Table of Contents
Codeigniter 4 Configuration
In Codeigniter 4 we can configure the database connection, base url, environment details in env file. We can also configure all the things using old method. Env file can be found in our Codeigniter 4 project root directory There we can see env file. We have to rename it ‘env to .env’.
1. Database Connection
After renaming open the file. Set your database details. Here is an example. You can see image also.
database.default.hostname = localhost database.default.database = ci4 database.default.username = root database.default.password = database.default.DBDriver = MySQLi database.default.DBPrefix = my_

2. Base Url Setup
We also configure base url using our .env file. Don’t forget to un-comment.
app.baseURL = 'http://mycodeigniter4.test'
3. Project Environment Setup
We will configure our project Environment using our .env file. Here an example
CI_ENVIRONMENT = development
If you have any question just drop the comment. You can use other contact mode to contact me. You can find it in on my Bio. Don’t forget to share with others.