What is the correct way to remove a package from Laravel using composer? So far I\'ve tried:
composer.json
(in "requir
There are quite a few steps here:
{ "require": { "twig/twig": "^3.0" } }
I wish to remove twig 3.0
Now open cmd and run composer remove vendor/your_package_name
as composer remove twig/twig
this will remove the package.
As a final step run composer update
this will surely give you a massage of nothing to install or update
but this is important in case your packages have inter-dependencies.
Running the following command will remove the package from vendor (or wherever you install packages), composer.json and composer.lock. Change vendor/package appropriately.
composer remove vendor/package
Obviously you'll need to remove references to that package within your app.
I'm currently running the following version of composer:
Composer version 1.0-dev (7b13507dd4d3b93578af7d83fbf8be0ca686f4b5) 2014-12-11 21:52:29
https://getcomposer.org/doc/03-cli.md#remove
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.
Normally composer remove
used like this is enough:
$ composer remove vendor/package
but if composer package is removed and config cache is not cleaned you cannot clean it, when you try like so
php artisan config:clear
you can get an error In ProviderRepository.php line 208:
Class 'Laracasts\Flash\FlashServiceProvider' not found
this is a dead end, unless you go deleting files
$rm bootstrap/cache/config.php
And this is Laravel 5.6 I'm talking about, not some kind of very old stuff.
It happens usually on automated deployment, when you copy files of a new release on top of old cache. Even if you cleared cache before copying. You end up with old cache and a new composer.json.
You can do any one of the below two methods:
Running the below command (most recommended way to remove your package without updating your other packages)
$ composer remove vendor/package
Go to your composer.json file and then run command like below it will remove your package (but it will also update your other packages)
$ composer update
Running the following command
composer remove Vendor/Package Name
That's all. No need composer update. Vendor/Package Name is just directory as installed before