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

psyopus's avatar

how to properly remove package?

I installed: composer require waavi/translation 2.3.x

but i decided i didnt want it so i did: composer remove waavi/translation 2.3.x

now everytime i do something with composer or artisan i get these errors:

$ composer update

Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover

                                                                  
  [Symfony\Component\Debug\Exception\FatalThrowableError]         
  Class 'Waavi\Translation\TranslationServiceProvider' not found  
                                                                  

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

$ composer dump-autoload      
                                                                                                                                                                                                          
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
                                                     
  [Symfony\Component\Debug\Exception\FatalThrowableError]         
  Class 'Waavi\Translation\TranslationServiceProvider' not found  
                                                 
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1
$ php artisan config:clear

                                                                  
  [Symfony\Component\Debug\Exception\FatalThrowableError]         
  Class 'Waavi\Translation\TranslationServiceProvider' not found  
$ php artisan config:cache                                                                                                    

  [Symfony\Component\Debug\Exception\FatalThrowableError]         
  Class 'Waavi\Translation\TranslationServiceProvider' not found                                                    
 $ php artisan cache:clear

                                                                  
  [Symfony\Component\Debug\Exception\FatalThrowableError]         
  Class 'Waavi\Translation\TranslationServiceProvider' not found 

the only reference i can find is in a cache dir:

grep -Ri 'waavi' ./* |grep -v logs
./bootstrap/cache/config.php:      19 => 'Waavi\\Translation\\TranslationServiceProvider',

i suspect there must be a command to clear that cache file but which command?

besides that, what is the proper way to remove packages without running into this mess?

0 likes
13 replies
daanb's avatar

To clear the config cache:

php artisan config:clear

or to clear and create a new cache file:

php artisan config:cache

Stratos's avatar

Try composer du

Nevermind you tried that. There might be something failing with the new autodiscovering in 5.5, try to remove the reference manually

psyopus's avatar

as in directly edit the file: ./bootstrap/cache/config.php

?

daanb's avatar

No, use the command php artisan config:clear for that.

psyopus's avatar

@daanb

i did but that fails:

$ php artisan config:clear

                                                                  
  [Symfony\Component\Debug\Exception\FatalThrowableError]         
  Class 'Waavi\Translation\TranslationServiceProvider' not found  
psyopus's avatar

ok, i removed that line from "bootstrap/cache/config.php" and now i can run my commands again without error.

next i need to do is to remove the package entirely is rollback the migration.. but also this gives me errors:

$ php artisan migrate:rollback

Migration not found: 2016_06_02_124154_increase_locale_length
Migration not found: 2013_07_25_145958_create_translations_table
Migration not found: 2013_07_25_145943_create_languages_table

why does this fail?

or am i missing something?

or how do i do this manually so i at least can move on with my project?

really appreciate any help.

psyopus's avatar

for anyone who finds this thread,

i resolved the rollback error with the --path option like so:

php artisan migrate:rollback --path=vendor/waavi/translation/database/migrations/

that is, just point 'path' to the migrations folder in the vendor dir. (in case package was already removed i suggest temporarily reinstall it, then rollback and finally remove package)

xenothan's avatar

Thanks @psyopus, was struggling with this. Reinstalled the waavi package, cleared the cache, rolled back migrations and then unistalled

sujancse's avatar

BTW @xenothan, you can completely remove a package by running

composer remove vendor/package-name

composer update

If laravel version < 5.5 then you have to delete the ServiceProvider for the package from config/app.php providers array.

Shahrukh4's avatar

You can do this by either following way,

1). remove the lines for any package in composer.json file.
2). run command  composer update
3). Package will automatically removed by composer

or

 a). composer remove vendor/your_package_name
 b). composer update
1 like
Maung-C's avatar

Make sure it's properly installed with composer and clear your bootstrap/cache/config into your provider array and remove applicable your package name and rearrange your key value.

Remove this your_key_number => 'Waavi\\Translation\\TranslationServiceProvider',

Please or to participate in this conversation.