I’m working on a Laravel project, and I’ve noticed that the RouteServiceProvider.php file is missing from the app/Providers directory. In the Laravel documentation and tutorials I’ve followed, it is typically present by default. I want to understand why it might be missing and how to restore it.
In addition to the AppServiceProvider, FortifyServiceProvider, and JetstreamServiceProvider, the RouteServiceProvider.php is supposed to be there, but it seems like it was never created in my project. How can I generate the missing RouteServiceProvider.php file and restore its functionality in my Laravel application?
I tried searching for a solution online and also checked if there is any Laravel Artisan command to regenerate this specific provider. I expected to find an easy way to either regenerate it using a command or instructions on restoring it without affecting my current setup.
What I expected to happen:
I expected to find a straightforward solution to restore the missing RouteServiceProvider.php file—either through an Artisan command or by manually creating it with the correct structure.
2
Answers
From Laravel 11 changed files structure.
You can config routing and middleware from
You can read official doc.
There’s a structure change in the latest version of Laravel (v11). Providers are now registered in
bootstrap/provider.php
file. The file returns an array of providers like below: