Reputation: 554
Is there a way to dynamically remove a service provider from the 'providers' array in config/app.php?
Upvotes: 2
Views: 3592
Reputation: 41350
if you want to remove a service from service provider, just make it null.
app()->instance(SomeClass::class, null);
Upvotes: 1
Reputation: 9988
You can place the service providers registration in app service provider in the register
method:
public function register()
{
if ($yourConfition) {
$this->app->register('SpecifiedServiceProvider');
}
}
and of course remove it from config.
Upvotes: 1