简体   繁体   中英

composer install a package fail

I need to include a non composer repository( https://github.com/ECPay/ECPayAIO_PHP ) in my laravel project but getting an error :

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.

Here is my composer.json file

{
    "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"
    }
}

Sounds like the package name error, is that not "ECPay/ECPayAIO_PHP" ?, Any Idea?

To use a git repo as the source for a composer package, you only need to define the repository in the list of repositories as type=vcs, then composer should be able to find your package. The docs for that are here: https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository

If you want a more detailed example, I also blogged about this when I had the same problem ( https://lornajane.net/posts/2014/use-a-github-branch-as-a-composer-dependency ) - note that if you want the version in the master branch, the package version wants to be dev-master .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM