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

jovs's avatar
Level 4

Laravel 5.1 PHP artisal route:list Fatal Error

Hi,

I was trying to list all the routes of my app so I tried php artisan route:list. and this is the error I got see the below code. Note that my current app name is 'App' and 'laravel5learning' is my previous app name. How can I fix this?

  [Symfony\Component\Debug\Exception\FatalErrorException]
  Class 'laravel5learning\Http\Controllers\Controller' not found
0 likes
7 replies
jovs's avatar
Level 4

All my routes is working fine but when I only use "php artisan route:list" it fails. anyway here is my routes.php file


Route::get('/', function () {
    return view('welcome');
});


Route::get('about','PagesController@about');
Route::get('contact-us','PagesController@contact');

Route::group(['middleware' => 'admin'],function(){
    Route::group(['prefix' => 'admin'],function(){
        Route::resource('articles','ArticleController');
    });
});

Route::controllers([
    'auth' => 'Auth\AuthController',
    'password' => 'Auth\PasswordController'
]);

skliche's avatar

@mikro123456 The full stacktrace should tell you where the problem is. Are you still using the namespace laravel5learning somewhere, copied some files from the previous project?

jovs's avatar
Level 4

@skillche This is the same project, I just changed my app name from 'laravel5learning' to the default 'App' name. This is working fine but when I tried to list all my routes using php artisan route:list and I get that error

Francismori7's avatar

Is composer.json referencing the right namespace? Did you dump-autoload? (composer dump-autoload)

skliche's avatar

@mikro123456 I understand, I ran into this problem after renaming one my first Laravel applications as well. There still has to be a reference to the old name somewhere. If you are using an IDE like PHPStorm do a full search (Edit->Find->Find in Path) of "laravel5learning" across all files in your project directory and all sub-directories.

jovs's avatar
jovs
OP
Best Answer
Level 4

Well, thanks to you guys I already fixed this issue just like @skliche suggested I find all the occurrences of 'laravel5learning' namespace on my app and I found out that the package that I just require using composer was using the previous namespace 'laravel5learning' and then I changed it to 'App' again and 'route:list' is already working smoothly.

Please or to participate in this conversation.