Composer: Uninstall / unrequire command for global dependencies

Created on 12 May 2014  ·  3Comments  ·  Source: composer/composer

It would be really interesting to have an command for uninstall a package.

It is true that for a particular project, we can directly edit the composer.json file, but when the library is installed in global mode, we must change the composer.json file in the folder defined by COMPOSER_HOME, which frankly is not easy!

I take an example with PHPUnit:

Since version 4.0, it is recommended to use Composer (in global mode) instead of PEAR. Ok, It's cool, we use our favorite tool of dependency management, and we follow the documentation for the install:

$ composer.phar global require "phpunit/phpunit=4.0.*"

Except that now, a new update is available, the 4.1. A simple update does not pass to the higher release, and change the version number in command line is not possible:

$ composer.phar global require "phpunit/phpunit=4.1.*"

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: phpunit/phpunit-mock-objects[2.1.0, 2.0.5].
    - Can only install one of: phpunit/phpunit-mock-objects[2.1.0, 2.0.5].
    - phpunit/phpunit 4.1.0 requires phpunit/phpunit-mock-objects ~2.1 -> satisfiable by phpunit/phpunit-mock-objects[2.1.0].
    - Installation request for phpunit/phpunit 4.1.* -> satisfiable by phpunit/phpunit[4.1.0].
    - Installation request for phpunit/phpunit-mock-objects == 2.0.5.0 -> satisfiable by phpunit/phpunit-mock-objects[2.0.5].

It is therefore necessary to manually change the global composer.json file, which is not easy.

The problem also arises when one wants to test or temporarily use a library in global mode: impossible to easily uninstall by command line.

Is it possible to add this command? I think that would be very useful since Composer can install libraries in global mode.

Most helpful comment

For anyone coming here from Google, there is composer global remove now available.

E.g.:

composer global remove fabpot/php-cs-fixer

All 3 comments

duplicate of https://github.com/composer/composer/issues/1622 (once composer unrequire will be implemented, it will be available in global mode as well automatically)

@stof Sorry, yet I checked before creating this issue.

For anyone coming here from Google, there is composer global remove now available.

E.g.:

composer global remove fabpot/php-cs-fixer
Was this page helpful?
0 / 5 - 0 ratings