php - 为什么 Composer 安装不同的包?

标签 php magento composer-php

我一直在使用 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您会注意到替换部分:

Package Screenshot

由于 Packagist 上不提供 magento-hackathon/magento-composer-installer,composer 将为您提供 aoepeople/composer-installers

关于php - 为什么 Composer 安装不同的包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23329463/

相关文章:

php - 如何在使用 PHP 调试在 Visual Code 中调试时设置变量值?

magento - checkout_cart_product_add_after 观察者未在实时服务器中触发,但在本地服务器中工作

mysql - Magento:用于查找没有特定子类别的产品的 SQL 查询

php - 将php composer软件包添加到我的git仓库中

PHP echo 相当于记事本的CR LF

php - 普通ajax和长轮询的区别

php - Magento - 如何在 EE 1.9 中使用 JoinTable 函数

php - 我怎样才能加快 Composer 的安装速度?

composer-php - 如何更改 "composer init"命令的默认供应商名称

javascript - 如何从浏览器安装脚本到手机并运行?