Config
The Config package gives Quantum one shared in-memory configuration store.
Use it when you want to load PHP config files through Loader, read values with dot notation, and override values at runtime.
What this package does
- loads config arrays from PHP files through
Quantum\Loader\Setup - stores values in one dot-accessible container
- supports two loading modes:
load()for the root store andimport()for named config sections - exposes a DI-backed
config()helper for shared access
Most applications use import()
Quantum's package-level config files are usually imported under their file name:
use Quantum\Loader\Setup;
config()->import(new Setup('config', 'app'));
config()->import(new Setup('config', 'database'));
$appName = config()->get('app.name');
$defaultDatabase = config()->get('database.default');
This is the normal shape used across the framework: each imported file becomes a top-level key such as app, database, or mailer.
When load() is a better fit
Use load() when you want one config file to become the entire root store instead of being nested under its filename.
use Quantum\Config\Config;
use Quantum\Loader\Setup;
$config = new Config();
$config->load(new Setup('config', 'app'));
$debug = $config->get('debug');
With load(), keys come from the file directly. With import(), the same file would be read under app.debug.
Package shape
Quantum\Config\Configmanages the in-memory storeQuantum\Config\Contracts\ConfigInterfacedefines the public APIQuantum\Config\Helpers\config.phpexposes the shared helperQuantum\Config\Exceptions\ConfigExceptionreports import-name collisions
Important runtime constraints
config()returns one sharedConfiginstance from DI, so runtime changes are shared for the current container lifecycle.load()is one-shot. After the first successful load, laterload()calls do nothing until youflush().import()always stores loaded data under theSetupfilename.- Import collisions are only guarded by that top-level filename. Re-importing the same truthy filename throws a
ConfigException. - For predictable imports, use a real non-empty filename in
Setup.