Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove repositories from composer command line

My project had a dependency that was on github, so when I installed it I ran

$ composer config repositories.vendor/package vcs https://github.com/vendor/package.git
$ composer require vendor/package

Now, I need to remove that package.
If I just run $ composer remove vendor/package the "repositories" section is still in my composer.json file.

"repositories": {

        "type": "vcs",
        "url": "https://github.com/vendor/package.git"
    },

How can I also remove the "repositories" section from the command line?

like image 261
Haim Avatar asked Feb 05 '19 16:02

Haim


People also ask

How to remove a package from composer using composer remove?

The “ composer remove” command removes packages installed and registered in the composer.json file from the working directory. An example is shown in the code snippet below: The above command completely removes the package with the name given in the command. This composer removes command also accepts a series of options. As discussed below:

How do I add repositories to my project in composer?

By default only the Packagist repository is registered in Composer. You can add more repositories to your project by declaring them in composer.json. Repositories are only available to the root package and the repositories defined in your dependencies will not be loaded.

How to get help from the composer command-line?

This chapter documents all the available commands. To get help from the command-line, call composer or composer list to see the complete list of commands, then --help combined with any of those can give you more information. As Composer uses symfony/console you can call commands by short name if it's not ambiguous.

How do I uninstall composer from Ubuntu?

If you install the composer as global on Ubuntu, you just need to find the composer location. and then just remove the folder using rm command. Show activity on this post. Delete composer.phar from where you've putted it.


Video Answer


1 Answers

You can run composer config --unset repositories.vendor/package to remove the entry from the repositories key.

However, this will still keep the empty repositories key. If you also want to remove that, you will have to use another tool that is able to parse JSON and remove the key yourself.

like image 180
xabbuh Avatar answered Oct 08 '22 13:10

xabbuh