php – composer:有没有办法为包存储库指定首选项顺序?
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php – composer:有没有办法为包存储库指定首选项顺序?,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1685字,纯文字阅读大概需要3分钟。
内容图文
![php – composer:有没有办法为包存储库指定首选项顺序?](/upload/InfoBanner/zyjiaocheng/797/7deff9a6e56e401192b9e2cb9a8d8c84.jpg)
我正在使用packagist和firegento上的包vendorName / moduleName(Magento扩展).
在我的composer.json文件中,我有:
"require": {
....................,
...................,
"vendorName/moduleName":"*"
},
"repositories": [
......................,
....................,
{
"type": "composer",
"url": "https://packages.firegento.com"
}
],
如Composer is downloaded pre-configured to use packagist.org所示,vendorName / moduleName从packagist加载.
我想强制从firegento加载vendorName / moduleName.
我试着添加:
"repositories": [
{
"packagist": false
},
但是,作曲家将不再在packagist中搜索:这不是我想要的.(因为packagist中也有有用的包…)
我想我可以用
composer config --global --unset repositories.packagist
然后
composer config --global repositories.firegento composer https://packages.firegento.com
composer config --global repositories.packagist composer https://packagist.org
以我的首选顺序添加存储库(我不确定它是否有效……).
有没有更好/更简单的方法来达到我的目的?我更喜欢编辑composer.json而不是运行全局配置命令,但它可能不可能.
解决方法:
好,
我想我找到了答案here:
Repository candidates are, in the end, only evaluated by their order of definition. Packagist is internally added as the last one by definition (though you can disable that) to ensure local copies are always preferred, if allowed by resolver settings.
这意味着如果我在composer.json中定义firegento repo,那么composer将在packagist之前加载firegre中的包vendorName / moduleName.我以为这是相反的行为;我错了.
另一个有用的评论here:
Order of repository definitions matters. But composer will still search through all repositories regardless, because it could be that a repository that is defined later has a more recent version available of the package you are requiring.
内容总结
以上是互联网集市为您收集整理的php – composer:有没有办法为包存储库指定首选项顺序?全部内容,希望文章能够帮你解决php – composer:有没有办法为包存储库指定首选项顺序?所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。