Composer: remove a package, clean up dependencies, don't update other packages

后端 未结 5 941
礼貌的吻别
礼貌的吻别 2021-01-30 19:46

The situation

Let\'s say I have a project with two packages installed by Composer:

php composer.phar require \'squizlabs/php_codesniffer:~2.0\' \'phpmd         


        
5条回答
  •  礼貌的吻别
    2021-01-30 20:42

    Do this:

    php composer.phar remove phpmd/phpmd
    

    Modify the composer.json file so it contains the following require section.

    {
        "require": {
            "squizlabs/php_codesniffer": "2.0.*",
        }
    }
    

    Now run composer.phar update. That should get you where you want to be.

    Note: You could also pin the php_codesniffer package to a specific version e.g. 2.0.0. More information about how composer does versioning can be found on here.

提交回复
热议问题