Hi, i want to use laminas-config-aggregator inside my slim app but it’s not working
as i don’t have the needed know to make it work,
This is what i have done so far.
<?php
declare(strict_types=1);
namespace Ultral\Config;
use Laminas\ConfigAggregator\ConfigAggregator;
use Laminas\ConfigAggregator\PhpFileProvider;
class AppConfig {
public function __construct(Config $config)
{
$this->config = $config;
}
/**
* @return mixed
*/
public function getConfigAggregator($MergedConfig): Aggregator
{
$aggregator = new ConfigAggregator([
new PhpFileProvider('/../../config/*.php'),
]);
return ($aggregator->getMergedConfig()) ? $this->config : $this->config[$MergedConfig];
}
}
This is the class to configure Laminas-config and to load the nedded config files and merged them.
And inside my container.php file i want to get the merged files and use them.
// Config
AppConfig::class => function (ContainerInterface $container) {
return new PhpFileProvider($container->get(App::class));
},
Please help me.
Thanks.