无法使用 composer 安装 Horde Imap 客户端

Cannot install Horde Imap Client with composer

我尝试安装 Horde/Imap_Client,如文档所述 here

在一个空目录中,我创建了一个 composer.json 文件,内容如下

{
    "repositories": [
        {
            "type": "pear",
            "url": "http://pear.horde.org"
        }
    ],
    "require": {
        "pear-pear.horde.org/Horde_Imap_Client": "*"
    }
}

然后我下载 composer 可执行文件和 运行 安装 运行 执行以下 2 个命令

curl -s http://getcomposer.org/installer | php
php composer.phar install

在 Mac OS X 和 Ubuntu 14.04 上,下载和安装过程均失败。我收到的消息是

Initializing PEAR repository http://pear.horde.org PEAR repository from http://pear.horde.org could not be loaded. Your configuration does not allow connection to http://http://pear.horde.org. See https://getcomposer.org/doc/06-config.md#secure-http for details. Installing dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.

Problem 1 - The requested package pear-pear.horde.org/horde_imap_client could not be found in any version, there may be a typo in the package name.

Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting see https://getcomposer.org/doc/04-schema.md#minimum-stability for more details.

Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

是 Horde/Imap_Client 被弃用了还是我做错了什么?

您希望错误详细到什么程度?

Initializing PEAR repository http://pear.horde.org PEAR repository from http://pear.horde.org could not be loaded. Your configuration does not allow connection to http://http://pear.horde.org. See https://getcomposer.org/doc/06-config.md#secure-http for details.

Composer 不再允许从开箱即用的不安全来源安装软件包。遗憾的是,Horde PEAR 存储库目前不支持 HTTPS,因此您不能那样做。然而,另一种方式在文档中非常清楚,只需将其添加到您的 composer.json 文件中:

    "config": {
      "secure-http": false
    }

所以看起来像这样:

{
    "repositories": [
        {
            "type": "pear",
            "url": "http://pear.horde.org"
        }
    ],
    "require": {
        "pear-pear.horde.org/Horde_Imap_Client": "*"
    },
    "config": {
        "secure-http": false
    }
}

请注意,此 将完全禁用 所有 安全通信检查 。因此,您打开了通过 DNS 中毒、MitM 攻击等方式在您的系统上安装随机代码的大门。 根本的解决方案是让 Horde PEAR 存储库维护者窃听以将 SSL 证书添加到他们的存储库。

Horde 最近添加了对 HTTPS 的支持,允许您在没有 'secure-http'=false 标志的情况下使用 Composer。

因此您可以使用存储库: https://pear.horde.org