Config Helpers
The package exposes one helper.
config()
function config(): Config
Use it when you want the shared configuration store managed by Quantum DI.
use Quantum\Loader\Setup;
config()->import(new Setup('config', 'app'));
if (config()->has('app.debug')) {
$debug = config()->get('app.debug');
}
Behavior:
- checks whether
Config::classis registered in DI - registers it if missing
- returns the shared
Configinstance
What that means in practice
- repeated
config()calls reuse the same store - values written with
set()are visible through later helper calls flush()resets the same shared instance instead of creating a second store
If you need an isolated config store for a narrow task, instantiate new Config() yourself instead of using the helper.