What is the Config system in CodeIgniter 4?
Why Interviewers Ask This
This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex CodeIgniter topics. It also reveals how well you can explain technical ideas to non-experts.
Answer
CodeIgniter 4 uses PHP class-based configuration — each config file in app/Config/ is a PHP class extending CodeIgniter\Config\BaseConfig with public properties. Example: class App extends BaseConfig { public string $baseURL = "http://localhost:8080"; }. Load config: $config = config("App") — returns the singleton instance. Access properties: config("App")->baseURL. Environment overrides: values can be overridden by environment variables following the pattern app.baseURL → APP_BASEURL in the .env file. This eliminates the need to change PHP config files per environment. The .env file supports all config keys in dot notation. Spark commands can also read config values. CI4's approach is more type-safe and IDE-friendly than CI3's array-based configuration.
Pro Tip
Back up your answer with a specific project or situation. Saying 'In my last CodeIgniter project, I used this when...' immediately makes your answer more credible and memorable.
Previous
What is an Entity in CodeIgniter 4?
Next
What are the built-in CodeIgniter 4 Response methods?