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?
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:
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With