This document shows the minimal setup for loading a config file.
use LiquidRazor\ConfigLoader\ConfigLoader;
use LiquidRazor\ConfigLoader\Value\LoaderOptions;
$loader = new ConfigLoader(
new LoaderOptions(
configRoot: __DIR__ . '/config',
),
);
$config = $loader->load('services');With YAML as the default format, services resolves to either:
config/services.yamlconfig/services.yml
- the config root is validated first
- the file is resolved for the selected format
- the file is parsed into an array
- the resulting array is interpolated and returned
- invalid root path
- missing config file
- invalid YAML syntax
- missing environment variables referenced without defaults