How does the “replace” property work with composer?

后端 未结 2 807
迷失自我
迷失自我 2021-01-30 08:39

So how does the \"replace\" property work with composer? I have read the composer document but still not understand it. Searching for more info hasn\'t answered my questions.

2条回答
  •  长发绾君心
    2021-01-30 09:05

    When you create your own package, you define in your composer.json what kind of packages does it provide which basically tells Composer that your package has it already installed, so no need to install it again.

    If you use replace property, it tells Composer that your package wants to replace the original package with your own fork, so other packages don't need to install it.

    For example if a/a package requires b/b and you tell to replace b/b, it won't be downloaded on Composer install/update.

    This is explained in more details in here: How does the “replace” property work in Composer?

提交回复
热议问题