Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

spbaniya's avatar

Package config file is appending `php`

I am creating a package with config file messenger.php I'm trying to access a variable inside messenger.php in a class of the package

return [
    'default' => env('DEFAULT_MESSENGER_DRIVER', 'longcode'),
];

When trying to access messenger.default it's not working because for some reason php appended and have to do messenger.php.default to make it work. Why is this happening?

0 likes
4 replies
bobbybouwmann's avatar

Did you register the file in the service provider in the correct method? It should be in the boot method.

spbaniya's avatar

@bobbybouwmann @jlrdw It was my mistake

$this->mergeConfigFrom(__DIR__ . '/../config/messenger.php', 'messenger');

Instead of above, I was using

$this->mergeConfigFrom(__DIR__ . '/../config/messenger.php', 'messenger.php');

Please or to participate in this conversation.