How to remove a package from Laravel using composer?

前端 未结 16 1884
[愿得一人]
[愿得一人] 2020-11-28 17:10

What is the correct way to remove a package from Laravel using composer? So far I\'ve tried:

  1. Remove declaration from composer.json (in "requir
相关标签:
16条回答
  • 2020-11-28 18:05

    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.

    0 讨论(0)
  • 2020-11-28 18:06

    Simpliest and Easiest way

    Syntax:

    composer remove <package>
    

    Example:

    composer remove laravel/tinker
    
    0 讨论(0)
  • 2020-11-28 18:07

    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

    0 讨论(0)
  • 2020-11-28 18:09

    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.

    0 讨论(0)
提交回复
热议问题