[英]how can I install package in composer without dependency
I am using composer
with symfony php
. 我正在使用带有symfony php
composer
。
There is one bundle A
which has dependency on Another bundle B v 1.1
. 有一个bundle A
依赖于另一个bundle B v 1.1
。
But I have the latest version of bundle B v 2
. 但是,我拥有bundle B v 2
的最新版本。
Now I want to install bundle A
without installing its dependency bundle B v 1.1
. 现在,我想安装bundle A
而不安装其依赖bundle B v 1.1
。
How do I proceed ? 我该如何进行? Please suggest. 请提出建议。
setup: 设定:
The latest ladybug-bundle version is 1.0.2
but there have meanwhile been some more commits. 最新的瓢虫捆绑版是1.0.2
但是与此同时,还进行了一些提交。 It requires ladybug version is 1.0.8
which doesn't include the latest changes aswell. 它要求瓢虫版本为1.0.8
,其中也不包括最新更改。
solution: 解:
An easy solution would be using an inline-alias . 一个简单的解决方案是使用inline-alias 。 Something like: 就像是:
"require" : {
"raulfraile/ladybug-bundle": "dev-master as 1.0.3"
"raulfraile/ladybug": "dev-master as 1.0.9"
}
alternative: 替代方案:
You can define a package with the same name in your composer.json that includes the altered dependency. 您可以在composer.json中定义一个具有相同名称的包,其中包括更改后的依赖项。
Just copy the package definition from the original package, add the dist/source locations and edit the requirements. 只需从原始包中复制包定义,添加dist / source位置并编辑需求即可。
composer will then use this new package definition because it picks the first match from all known repositories (packagist is always queried last). 然后,作曲家将使用这个新的程序包定义,因为它从所有已知存储库中选择第一个匹配项(总是查询包专家)。
You should choose a specific commit for the dist-zip. 您应该为dist-zip选择一个特定的提交。 An example: 一个例子:
"repositories": [
{
"type": "package",
"package": {
"name": "raulfraile/ladybug-bundle",
"version": "1.0.3",
"require": {
"raulfraile/ladybug" : "~1.0@dev"
},
"dist": {
"url": "https://github.com/raulfraile/LadybugBundle/archive/5c3739a881313f63f7b47ace49af5deeed211362.zip",
"type": "zip"
},
}
}
],
Now require "raulfraile/ladybug-bundle": "~1.0"
in your composer.json and it will use the 1.0.3
version you defined yourself. 现在需要"raulfraile/ladybug-bundle": "~1.0"
在你composer.json,它会使用1.0.3
你自己定义的版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.