-
Notifications
You must be signed in to change notification settings - Fork 134
Open
Description
Regarding an old issue #18:
It was asked how to handle when multiple config files share a variable name.
If you're loading in multiple config files, wouldn't it make more sense to contain each loaded file as its own array within the config container?
loading files:
- config/environment.php
- config/services.php
- config/database.php
These should be accessible in the following way:
$app->config = new Config(__DIR__ . '/../config');
$app->config->get('environment.name'); // the name variable is returned from the environment config
$app->config->get('database.server'); // the server variable is returned from the database config
Currently, all the config options are mashed together in a single array, which overwrites any duplicates.
Example:
server.php
<?php
return [
"system" => "debian",
"apache" => [
"location" => "/usr/bin/apache"
]
];environments.php
<?php
return [
"local" => [
"domain" => "dev"
],
"production" => [
"domain" => "domain.com"
]
];Outputs:
{
"local":{
"domain":"dev"
},
"production":{
"domain":"domain.com"
},
"system":"debian",
"apache":{
"location":"\/usr\/bin\/apache"
}
}However, I would like it to output:
{
"environments":{
"local":{
"domain":"dev"
},
"production":{
"domain":"domain.com"
},
},
"server": {
"system":"debian",
"apache":{
"location":"\/usr\/bin\/apache"
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels