Is there better way to retrieve global configuration

Hello everyone,
Is a better way to retrieve global configuration automatically loaded by laminas.

Current, i have defined the fine in the config/autoload folder to return array config.
Then, i my view, I had to load this config again using the laminas-config component. Since i could not understand a better way to retrieve this custom config.

My codes are:
define.global.php

return [
    'site_config' => [
        'site_name' => "Job Site"
    ]
];

layout.phtml

$config = Laminas\Config\Factory::fromFile(__DIR__.'/../../../../config/autoload/define.global.php');
//usage
$config['site_config']['site_name']

How can I achieve the above effectively using the normal process?
P.S: Am still new to laminas.

You should not implement such login in a view. Instead pass required config data as view data. This means you need to fetch your config data in the controller action or request handler. Best is to have your configuration as a dependency.

Eg.: a request handler in Mezzio:

class IndexHandler implements RequestHandlerInterface
{
    /**
     * @var TemplateRendererInterface
     */
    protected $config;

    public function __construct(TemplateRendererInterface $renderer, array $config)
    {
        $this->renderer = $renderer;
        $this->config = $config;
    }

    public function handle(ServerRequestInterface $request) : ResponseInterface
    {
        return new HtmlResponse($this->renderer->render(
            'site::index',
            [
                'site_name' => $this->config['site_config']['site_name']
            ]
        ));
    }
}

And the factory class for that:

class IndexHandlerFactory
{
    public function __invoke(ContainerInterface $container) : ItemGroupHandler
    {
        return new ItemGroupHandler(
            $container->get(TemplateRendererInterface::class),
            $container->get('config')
        );
    }
}

Notice that you fetch the conifg data in the factory from the DI container and pass it to the request handler as a dependency.