Bad Programmer
Bad Programmer

Reputation: 952

Class 'Illuminate\Routing\ControllerServiceProvider' not found While Upgrading from Laravel 5.1 to 5.2

I have a Laravel 5.1 install that I am upgrading. I meticulously followed the instructions available at https://laravel.com/docs/5.3/upgrade#upgrade-5.2.0 for the upgrade, including removing Illuminate\Foundation\Providers\ArtisanServiceProvider and Illuminate\Routing\ControllerServiceProvider from the config/app.php file (I am stressing this point, as googling for this issue has suggested this in every response).

Despite this, I am still getting this error when I run composer cache:clear

[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Illuminate\Routing\ControllerServiceProvider' not found error 

and see this error in my browser:

FatalThrowableError in ProviderRepository.php line 146:
Class 'Illuminate\Routing\ControllerServiceProvider' not found

Thinking that perhaps references to these classes were being cached, I checked bootstrap/cache/services.json and removed the references from there as well and then ran composer dump-autoload but I am still getting this error.

I also made sure to copy over example config/app.php from Laravel 5.2 clean install example here: https://raw.githubusercontent.com/ziyed/Laravel-5.2/master/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php

I have read through the similar threads on StackOverflow and Laracast and tried tried to use the advice contained inside, but nothing seems to work.

Any help would be greatly appreciated. For reference, my dev setup is running on a local XAMPP stack under a Windows 10 OS. The other environments are remote, using a traditional LAMP stack with Amazon Linux 2. I was trying to do the upgrade locally.

Upvotes: 0

Views: 487

Answers (2)

Bad Programmer
Bad Programmer

Reputation: 952

I am closing this question, not because I found an answer, but because continuing down this path just didn't pass a cost/benefit analysis. After upgrading to 5.2, the next upgrade would be 5.3, and the breaking changes between 5.2 to 5.3 is a lot higher than between 5.1 to 5.2. After some thought, it was obvious that the better approach would be a fresh install on my target version, and then start porting over each module in my project by copying over the views, updating the routing, and making changes to the controllers and middleware as needed.

Or just using Laravel Shift.

Thank you to everyone who chimed in with suggestions!

Upvotes: 1

gramgram
gramgram

Reputation: 565

Illuminate\Routing\ControllerServiceProvider is not present anymore.

When I recently had to upgrade the same versions as you, I had to run composer update before and after removing Illuminate\Routing\ControllerServiceProvider::class and Illuminate\Foundation\Providers\ArtisanServiceProvider::class to make it work. Also worth to mention you need to clear bootstrap/cache. It worked for me.

Edit: i noticed now you tried the last step partially as well. You can remove all php files from cache.

Upvotes: 1

Related Questions