set('app.name', 'My Application'); $config->set('app.url', 'https://example.com'); echo $config->get('app.name'); // output: My Application ?>
load('config.yaml'); echo $config['app']['name']; // output: My Application ?>In this example, we are using the Symfony/Config package to load configuration values from a YAML file. We create a new `FileLocator` object to point to the directory containing our configuration files. We then create a new `LoaderResolver` object containing loaders for YAML, INI, and PHP files. We create a new `DelegatingLoader` object to handle loading the appropriate loader based on the file extension. Finally, we use the `load` method to load the configuration values from the `config.yaml` file. Overall, these examples use different packages/libraries to load configuration files in PHP applications. The first example uses the Illuminate/Config package, while the second example uses the Symfony/Config package.