我一直在使用 Magento Firegento 自定义 Composer 安装程序,但遇到了一些我不明白的奇怪的 Composer 行为。
考虑以下极其简单的 composer.json
文件
{
"require": {
"magento-hackathon/magento-composer-installer": "*"
}
}
如果我使用此 composer.json
文件运行 compser.phar install
,我会得到以下内容。
$ composer.phar install --no-dev
Loading composer repositories with package information
Installing dependencies
- Installing aoepeople/composer-installers (v0.0.1)
Loading from cache
Writing lock file
Generating autoload files
根据我大多数外行人的理解composer.phar
,我说过
Hey, composer, please install the
magento-hackathon/magento-composer-installer
package from packagist.org
Composer 回复了我
Sir, yes sir! Here's the
aoepeople/composer-installers
package
当我要求 magento-hackathon/magento-composer-installer
时,我不明白为什么 Composer 安装了 aoepeople/composer-installers
。
需要明确的是:我理解没有安装 magento-hackathon/magento-composer-installer
的原因是这是一个位于 different composer repository 中的软件包。 。我最初的错误是没有将此存储库包含在我的 composer.json
文件中。
但是, Composer 安装与我要求的包不同的包对我来说是没有意义的。当我 search packagist there's no magento-hackathon/magento-composer-installer
extension 。
为什么 Packagist 安装不同的扩展?幕后发生了什么使 magento-hackathon/magento-composer-installer
解析为 aoepeople/composer-installers
?将来我可以在 Composer 源代码中如何/在哪里自己调试此类事情?
最佳答案
Vinai 发表了一篇关于 Magento 和 Composer 的精彩文章 here 。
引自那里
Composer will use packagist.org to look where to get the libraries. Because Magento modules aren’t listed there, you will have to add the packages.firegento.org repository to the configuration as follows [...]
所以你需要存储库
"repositories":[
{
"type":"composer",
"url":"http://packages.firegento.com"
}
],
获取 magento Composer 安装程序。
是的, Composer 提供替代品。包装上的条目为aoepeople/composer-installers您会注意到替换部分:
由于 Packagist 上不提供 magento-hackathon/magento-composer-installer
,composer 将为您提供 aoepeople/composer-installers
。
关于php - 为什么 Composer 安装不同的包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23329463/