php - 使用 composer 安装 PEAR 扩展 HTTP_Request2

标签 php pear composer-php

我有一个 composer.json 文件:

{
    "name": "vendor/Project",
    "description": "description_text",
    "repositories": [
        {
            "type": "pear",
            "url": "http://pear.php.net"
        }
    ],
    "require": {
        "jakeasmith/http_build_url": "dev-master",
        "phpmailer/phpmailer": "dev-master",
        "pear-pear/Text_Diff": "*",
        "pear-pear/Net_IDNA2": "*",
        "pear-pear/HTTP_Request2": "2.2.1"
    },
    "require-dev": {
        "phpunit/phpunit": "< 4.0.0"
    }
}

当我尝试执行命令时 php composer.phar install 我得到了这个:

Loading composer repositories with package information
Initializing PEAR repository http://pear.php.net
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for pear-pear/http_request2 2.2.1 -> satisfiable by pear-pear.php.net/HTTP_Request2[2.2.1].
    - pear-pear.php.net/HTTP_Request2 2.2.1 required pear-pear.php.net/net_url2 >=2.0.0.0 -> no matching package found.

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://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

为什么我会收到错误消息?我真的应该将所有 pear 依赖项存储在我的 composer.json 文件中以用于 HTTP_Request2 扩展吗?

附言如果我用

运行 php composer.phar install
"pear-pear/Archive_Tar": "*",
"pear-pear/Console_Getopt": "*",
"pear-pear/Structures_Graph": "*",
"pear-pear/XML_Util": "*",
"pear-pear/PEAR": "*",
"pear-pear/Net_URL2": "*"

然后添加一个字符串:"pear-pear/HTTP_Request2": "2.2.1" 并运行 php composer.phar update - 一切正常魔法!但我认为这不是正确的方法。

最佳答案

通过重命名修复:

"pear-pear/HTTP_Request2": "2.2.1"

"pear-pear.php.net/HTTP_Request2": "2.2.1"

关于php - 使用 composer 安装 PEAR 扩展 HTTP_Request2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22310051/

相关文章:

php - 关于引号的 SQL 查询错误

php - pear 安装后 Nginx 不运行 php 文件

php - 如何在 DDEV 的 Web 容器中安装像 mcrypt 这样的 pecl 扩展?

php - 如何在代理后面使用 PEAR?

php - 我们可以使用具有稀疏 SVN check out 功能的 Composer 来共享依赖项吗?

php - 如何将所有订单地点数据与 Magento 默认表一起保存在自定义表中?

php - 使用 PHP 进行 MySQL 查询

php - 使用 PHP 为每个 img 添加父级

composer-php - GitLab:Composer 使用 ssh key 安装私有(private)存储库(仍然出现错误无法下载)

php - 将 Laravel 5.5 升级到 5.6 错误