Let\'s say I have a project with two packages installed by Composer:
php composer.phar require \'squizlabs/php_codesniffer:~2.0\' \'phpmd
I do not believe this to currently be possible. This is the sort of thing that you may wish to submit as a feature request to Composer.
Meanwhile, I think your best bet is to go with option #1: php composer.phar remove phpmd/phpmd
It will remove the package from your explicit dependencies without forcing you to update anything. The obsolete dependencies from your removed library will remain until you next run composer update
, which is something you should be doing periodically anyway. Most of the files from the old dependencies should be set to autoload one way or another, so you shouldn't have any real penalties for keeping those files around other than the space they use on disk.