Hello Sebastian, So from what I can see it seems you would want to use the Config class to overwrite what Laravel's config function. You can first try clearing and rebuilding the config cache using:
php artisan config:clear
php artisan config:cache
If that doesn't work then in the app service provider ensure you are binding the new custom configuration in the register function. Like this:
$this->app->singleton(ConfigRepository::class, function ($app) {
return new CustomConfigRepository($app['config']->all());
});
Hello,
thanks for your reply.
would want to use the Config class to overwrite what Laravel's config function
No, that´s not my goal. I would like to use the Illuminate\Config functions without Laravel (therefore artisan is also not available). (Therefore I wrote it´s perhaps a bit off-topic :-)
I do not understand why the code above does not use a singleton (it should) when using Container->[..]->make.
Thanks, Sebastian
Oh okay, I get you now. So from what I can gather the binding method you are using would always create a new instance. Also the same is done with the App. I would try this:
// Bind the container itself to the instance
$container->singleton('app', function () use ($container) {
return $container;
});
// Correctly bind the `config` instance as a shared singleton
$container->singleton('config', function () {
return new Illuminate\Config\Repository();
});
I also had a question. Is there a reason you are using the Repository for the `class_alias` instead of the Config ?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community