Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 4, 2024 via composer

consolidation/config 2.1.2

Provide configuration services for a commandline tool.
Package summary
Share
0
issues
1
license
7
MIT
Package created
26 Jun 2017
Version published
6 Oct 2022
Maintainers
1
Total deps
7
Direct deps
3
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
7 Packages, Including:
consolidation/config@2.1.2
dflydev/dot-access-data@v3.0.2
grasmash/expander@3.0.0
psr/event-dispatcher@1.0.0
psr/log@3.0.0
symfony/event-dispatcher@v6.4.7
symfony/event-dispatcher-contracts@v3.5.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

3
All Dependencies CSV
ⓘ This is a list of consolidation/config 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
dflydev/dot-access-datav3.0.210.25 kBMIT
prod
grasmash/expander3.0.025.62 kBMIT
prod
symfony/event-dispatcherv6.4.7-MIT
prod

Visualizations

Frequently Asked Questions

What does consolidation/config do?

Consolidation/Config is a component designed to provide configuration services for a console command line tool. The package enables management of configuration options from different sources including command line options, configuration files, alias files (which specifically identify a target site), and default values that are provided by the command. It makes use of Symfony Console for the command line tool's framework and the Symfony Configuration component to load and merge configuration files.

How do you use consolidation/config?

To use consolidation/config, you will need to first introduce it into your project. The primary object for configuration import and export is theConfig object. Here's how to do it:

use Consolidation\Config\Config;
use Consolidation\Config\YamlConfigLoader;
use Consolidation\Config\ConfigProcessor;

$config = new Config();
$loader = new YamlConfigLoader();
$processor = new ConfigProcessor();
$processor->extend($loader->load('defaults.yml'));
$processor->extend($loader->load('myconf.yml'));
$config->import($processor->export());

You can also set-up command option configuration injection like this:

$application = new Symfony\Component\Console\Application($name, $version);
$configInjector = new \Consolidation\Config\Inject\ConfigForCommand($config);
$configInjector->setApplication($application);

$eventDispatcher = new \Symfony\Component\EventDispatcher\EventDispatcher();
$eventDispatcher->addSubscriber($configInjector);
$application->setDispatcher($eventDispatcher);

Configuration values can be easily fetched as follows:

$value = $config->get('a.b.c');

And you may perform interpolation like this:

$result = $config->interpolate('The value is: {{a.b.c}}');

Where are the consolidation/config docs?

Consolidation/Config’s documentation is located on GitHub, specifically the repository README file at the given URL: https://github.com/consolidation/config. This resource explains detailed usage, code examples, and additional functionalities of the package and even offers comparisons to similar utilities.