What is the Config system in CodeIgniter 4?

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.baseURLAPP_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.