Is it possible to ignore child dependencies in Composer config?

前端 未结 4 1333
独厮守ぢ
独厮守ぢ 2020-12-30 01:49

When I run composer install, it will install all my \"require\" and the \"require\" of the other package.

My composer.json

{
    \"name\": \"my_app\"         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-30 02:42

    You can ignore packages to be downloaded with the replace property of your composer.json: https://getcomposer.org/doc/04-schema.md#replace

    That way you tell composer, that you take or took care of that package's content on your own.

    This can help you to ignore a package your are sure you do not need, but it is kind of hacky. So be aware some things (like tests) might break. A better approach would be to request a patch from the maintainer of the original package to make the requirements optional (via the suggest property).

    edit:
    Example for "disabling" the requirement to zendframework/zend-mail:

    {
        "name": "my_app",
        "require": {
            "some/package": "0.0.0"
        },
        "replace": {
            "zendframework/zend-mail": "*"
        }
    }
    

提交回复
热议问题