What is the correct way to remove a package from Laravel using composer? So far I\'ve tried:
composer.json
(in "requir
We have come with a great solution. This solution is practically done in Laravel 6. If you want to remove any package from your Laravel Project then you can easily remove the package by following below steps:
Step 1: You must know the package name which you want to remove. If you don't know complete package name then you can open your project folder and go to composer.json
file and check name in require an array
"require": {
"php": "^7.2",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.2",
"laravel/passport": "^8.3",
"laravel/tinker": "^2.0"
},
Suppose, here I am going to remove "fideloper/proxy" package.
Step 2: Open command prompt with your project root folder directory Step 3: First of all clear all cache by following commands. Run commands one by one.
php artisan cache:clear
php artisan config:clear
Step 4: Now write the following command to remove the package. Here you need to change your package name instead of my example package.
composer remove fideloper/proxy
Now, wait for a few seconds your package is removing.
Syntax:
composer remove <package>
Example:
composer remove laravel/tinker
In case the given answers still don't help you remove that, try this:
Manually delete the line in require
from composer.json
Run composer update
Remove the package with
composer remove vendorname/packagename
you can check remove package from composer.json - docs
Or you can remove the package name from composer.json
file and run composer update
from within your project directory. I hope it helps.