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

ultrasamad's avatar

In ProviderRepository.php line 208: Class not found

I removed a composer package, with composer remove devdojo/chatter. But getting to the end of the command output I got

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover

In ProviderRepository.php line 208:

  Class 'DevDojo\Chatter\ChatterServiceProvider' not found


Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

So I can't run any of the artisan commands again. I keep getting Class 'DevDojo\Chatter\ChatterServiceProvider' not found. Do I need to manually clear something?

I deleted the vendor folder, check to make sure the package is not in the composer.json file, reinstalled the vendor packages and I got the same error at the end of the command output

0 likes
27 replies
xmarks's avatar

Have you tried:

composer dump-autoload
rin4ik's avatar

First try to remove the devdojo/chatter line your composer.json file and run composer update, if that doesn't work try composer dump-autoload

1 like
ultrasamad's avatar

@xmarks I did composer dump-autoload before and it ended with the same error as above when generating the optimized files.

ultrasamad's avatar

@rin4ik Yh...It was automatically removed when I ran composer remove command

1 like
zymawy's avatar
zymawy
Best Answer
Level 22

You Can Search Full Path In Your Entire Project And Delete It

'DevDojo\Chatter\ChatterServiceProvider'
4 likes
rin4ik's avatar

@ultrasamad try this as well composer update --no-scripts

Then: composer dump-autoload -o

Then,run an update again so pre/post update scripts can run: composer update

or another solution would be

Remove bootstrap/cache/config.php file.

composer dump-autoload

composer update
19 likes
bashy's avatar

Please don't just mention users to get their attention.

4 likes
NiMaKw's avatar

@rin4ik I run composer update --no-scripts after that, I ran composer dump-autoload -o, I got the same error as above.

With your second solution, there's no config.php in bootstrap/cache folder

1 like
RamjithAp's avatar

You can do any one of the below methods:

  1. Running the below command (most recommended way to remove your package without updating your other packages)
$ composer remove vendor/package

2 . Go to your composer.json file and then run the command like below it will remove your package (but it will also update your other packages)

$ composer update

3 . If you are still getting the error after you have done with all above steps, go to your projects bootstrap->cache->config.php remove the provider & aliases entries from the cached array manually.

2 likes
ultrasamad's avatar

@RamjithAp When removing the package I used $ composer remove vendor/package

There is no config.php in bootstrap/cache, rather is the packages.php and there is no entry for that package in the array.

2 likes
jswails's avatar

So I know this is old but maybe this will help as I ran into this exact same issue and about lost my mind.

I had cleared out the packages and services from everywhere in the project but they still kept breaking composer. dump-autoload would not work at all. what got me to see the issue was this. Removing this file bootstrap/cache/config.php that then broke the app in a way that actually made sense once I ran dump-autoload I got a message that app.php was broken which I had not noticed at all before that I had missed some parentheses and commas, ooof. So when I fixed those and then ran dump-autoload again then I found another layer of mistakes. I was able to fix those and then dump-autoload again and its all working. So the point here is its probably a real code screw-up somewhere as package removal is very simple and is not really the root cause but rather a symptom that expressed oddly. Hope this helps another internet stranger some day

2 likes
handexcel's avatar

Thanks, Solved same problem with other package.

remove the line of code associated with the error package.

location in bootsrap/cache/config.php

after remove: php artisan optimize and composer update

hopefully useful for the same problem

3 likes
hamidprog's avatar

Delete the DevDojo\Chatter\ChatterServiceProvider in app.php and go to composer.json and again delete it

Bilal89's avatar

"extra": { "laravel": { "dont-discover": [ "laravel/dusk" ] } },

totojekov@gmail.com's avatar

I had similar problem with JWTAuth. Go to bootstrap/cache/config.php. You'll see provider's array, find the offender delete the line and save file. After that run: composer dump-autoload composer update

These steps solved my issue.

Cheers!!

2 likes
vrushabh's avatar

to remove that error just install that package again $ composer install vendor/package it will refresh all file again and then after that if you dont want that package just remove package step by step

elo's avatar

I was facing similar issue and here's what worked for me. I simply ran composer update then composer dump-autoload and that got ride of the error.

thenuka's avatar

Thanks, This worked. -> Remove bootstrap/cache/config.php file.

crossmar's avatar

"Please don't just mention users to get their attention."

So @mentions should do what? Invite to a party? I wish I had as much time to correct arcane nonsense as some of you guys.

searaig's avatar

had the same issue when removing a custom nova tool in a feature branch that didn't get merged.

running composer dump-autoload -o solved for me :) thanks everyone

i also noticed that phpstorm was triggering a composer update check as a background process during the nova:tool install, so, I disabled the setting "Composer / Check for available package updates" and had no further issues.

oktech's avatar

Just remove the entry from the app.php from the providers array

2 likes
basiltap's avatar

After removing the package, delete also the app/bootstrap/cache/config.php file, and then type "composer dumpautoload" in your console. It should work

ardiardiyansyah's avatar

I think i've found the solution guys, i analyze from the composer file and i found it. try to open folder vendor/composer/ and open installed.json in code editor, search the package that you want to delete, and delete the array. and now you can try composer dump-autoload

Please or to participate in this conversation.