Replies: 6 comments 13 replies
-
In Laravel 11.x, the structure of the application has been updated, and certain configurations have been moved to different locations compared to Laravel 10.x. If you want to remove or modify default service providers in Laravel 11.x without directly editing the Here's how you can achieve this:
By following these steps, you can customize the loading of service providers in Laravel 11.x without directly modifying the |
Beta Was this translation helpful? Give feedback.
-
Remove default ServiceProviders// config/app.php
use Illuminate\Support\ServiceProvider;
'providers' => ServiceProvider::defaultProviders()->except([
Illuminate\Foo\FooServiceProvider::class,
])->toArray(), Replace// config/app.php
use Illuminate\Support\ServiceProvider;
'providers' => ServiceProvider::defaultProviders()->replace([
Illuminate\Foo\FooServiceProvider::class => Bar\BarServiceProvider::class,
])->toArray(),
|
Beta Was this translation helpful? Give feedback.
-
I have the same question... |
Beta Was this translation helpful? Give feedback.
-
You are trying to use the new structure in some parts but not in the others. Keep your laravel 10 structure, it is completely fine and 100% supported, you don't need to change a thing regarding configs/providers etc. |
Beta Was this translation helpful? Give feedback.
-
The only way I found to exclude service providers from the boot is to update composer.json + "extra": {
"laravel": {
"dont-discover": [
"Illuminate\\Redis\\RedisServiceProvider"
]
}
},
|
Beta Was this translation helpful? Give feedback.
-
Why is laravel community pushing for this new bootstrap/app.php way of bootstraping the application in comparison with the old laravel 10? Luckily for now both work. Will they block the old way in the future? |
Beta Was this translation helpful? Give feedback.
-
At 10.x we can just remove providers by comment the lines in app.php,
while 10.x also moved default providers to vendors. So that we can continue copy it out to app.php then remove something.
How can we do it in 11.x?
Just like #50500 , I don't think there will be no one creates a new laravel project.
Btw, if someone who can resolve the issue of #50500 is better, thanks a lot.
Beta Was this translation helpful? Give feedback.
All reactions