composer安装包失败

时间:2017-04-19 08:05:56

标签: php git github composer-php

我需要在我的laravel项目中包含一个非作曲家存储库(https://github.com/ECPay/ECPayAIO_PHP) 但得到一个错误:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package ecpay/ecpayaio_php 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.

这是我的composer.json文件

{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "ECPay/ECPayAIO_PHP",
                "version": "dev-master",
                "source": {
                    "url": "https://github.com/ECPay/ECPayAIO_PHP",
                    "type": "git",
                    "reference": "origin/master"
                }
            }
        }
    ],
    "require": {
        "ECPay/ECPayAIO_PHP": "master"
    }
}

听起来像包名称错误,是不是"ECPay/ECPayAIO_PHP"?,任何想法?

1 个答案:

答案 0 :(得分:0)

要使用git repo作为composer包的源,您只需要将存储库列表中的存储库定义为type = vcs,然后composer应该能够找到您的包。这方面的文档在这里:https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository

如果你想要一个更详细的例子,当我遇到同样的问题(https://lornajane.net/posts/2014/use-a-github-branch-as-a-composer-dependency)时,我也在博客上写了这篇文章 - 请注意,如果你想在master分支中使用该版本,那么包版本应该是{{ 1}}。