Using configuration file in DI container

Hello,
I have the following problem. I use a config file, lets say config.php which returns a simple array like many other config files in Yii package.
This config file returns array as a parameters for a class’s constructor:
$config = require_once DIR . ‘config.php’;
$resolver = new Resolver($config);
When I use code like above it works perfect, but I can’t find the way how can I realise the same in my DI container. I’ve tried many different approaches, but no avail.
One of them like this, for example:
$container->setSingleton(Resolver::class, [],[
‘conf’ => function() {
return require DIR . ‘config.php’;
}
]
);
Could anyone help me with this obstacle?
Thank you in advance!

Can’t you configure container via main config? https://www.yiiframework.com/doc/guide/2.0/en/concept-configurations#application-configurations

Unfortunately no, I have to use independent config file, which should be implemented in one class and for the sake of convenience of test etc. I should realise this config import in constructor of the class via DI container.
Of course, we can do it the following way:
public function __construct()
{
$this->config = require ‘SOME_PATH\config.php’;
}

But, from my point of view, more convenient way is DI container usage.
Alexander, can you give an advice how can implement this featrue?
All my attempts with set(), setSingletone, setDefinitions, callbacks etc. where unsuccessful, I think i miss something simple, but very important, because I always get NULL value from DI cointainer.
Thank you in advance!

Where do you call $container->setSingleton?

I use bootstrap class like:
class ApplicationBootstrap implements BootstrapInterface
{
public function bootstrap($app)
{
$container = \Yii::$container;

    $container->setSingleton(Resolver::class, [],[
        'config' => require('path/to/config.php')
    ]);
}

}

So config there is alright but then when you type-hint against a Resolve in the controller action you get null? Or how it doesn’t work exactly?

Dear Alexander,
We found the reason of getting the mistake, DI container works perfectly. The reason was in our framework’s config. We use DDD and had to change some base confis of the framework and it lead to misbehaviour of DI container intialization so container didn’t start in some tests.
Thank you very much for your support and we aager to see Yii 3!