Config
APPNETOS Core infrastructure component: Config.
Core\Config supplies the complete Core configuration. Applications may use only these defaults,
or selectively override settings such as MongoDB, Redis, mail, caching and sessions. Application-specific
files are optional unless the application itself requires additional properties.
Configuration loading order
The configuration arrays are merged recursively: unspecified values remain available from the earlier
files.
Custom configuration files may be placed directly in platform/config; there is no separate
custom-directory lookup for this mechanism.
Property mapping and extension
Configuration values are mapped to declared properties, including properties introduced through APPNETOS class extensions. The mapping is type-checked; configuration does not create arbitrary dynamic properties. Applications are responsible for supplying values required by their own additional properties.
// Example: override only the database name in an application config.
return [
'contexts' => [
'shared' => [
'mongodb' => [
'database' => 'my_application',
],
],
],
];
Runtime configuration
The Core resolves runtime URLs and directories, database and Redis parameters, context-specific cache and
security settings, and mail configuration. setConfigParameters() changes runtime
properties; it
does not write changes back to PHP configuration files.
Public API Reference
Core\Config
Class & Registry
Class:
Core\Config
Extends:
Core\Config\Base
use Core\Config;
use Core\Registry;
$config = Registry::get(Config::class);
| Method | Description |
|---|---|
init() |
Initialize and load configuration. |
setConfigParameters() |
Apply configuration values to declared properties. |
getInitialized() |
Return initialization state. |
getDebug() |
Return debug mode. |
getEnvironment() |
Return active environment. |
getConfigApplication() |
Return configured application. |
getBaseUrl / getContextUrl / getUrl() |
Read resolved URLs. |
getRootDir / getPublicDir / getVarDir() |
Read primary directories. |
getCacheDir / getTempDir / getLogDir / getCompileDir / getConfigDir() |
Read runtime storage directories. |
getMongodb / getMongodbUri / getMongodbDatabase() |
Read MongoDB configuration. |
getMongodbUriOptions / getMongodbDriverOptions() |
Read MongoDB client options. |
getRedis / getRedisPrefix / getRedisParameters / getRedisOptions() |
Read Redis configuration. |
getApp* / getAdmin*() |
Read app/admin cache, session, security, optimization, statistics and mail settings (context-specific methods). |
appUnsetCache / adminUnsetCache() |
Disable selected cache settings for the current runtime. |
The complete list of individual getters belongs in the generated class reference; the families above are grouped for readability.