Open tmgast opened 8 years ago
Hi, currently it should work if you manually pass in each file to the constructor, passing directories is not currently supported. Good idea for the future though.
@tmgast You can do this with https://github.com/m1/vars fyi
As I said before, would be a great idea for the next version. Another idea is you could have a main config.php
that is something like this:
<?php
return [
'server' => require_once('server.php'),
'environments' => require_once('environments.php')
]
You might want to take a look at https://github.com/samrap/gestalt .
It is a lot more flexible on how it loads configurations from files and even allows you to define custom loaders using an interface. It solves the multiple variable names by using the filename(s) as the root key(s) and nesting the values inside.
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?
These should be accessible in the following way:
Currently, all the config options are mashed together in a single array, which overwrites any duplicates.
Example: server.php
environments.php
Outputs:
However, I would like it to output: