php - 无法在我的 Laravel 项目中使用分支存储库 - "Could not find a matching version of package"

标签 php laravel git composer-php

我用别人的 fork ( https://github.com/digital-bird/LaravelShoppingcart ) 做了我的 fork ( https://github.com/hardevine/LaravelShoppingcart )。

我想在我的 Laravel 项目中使用我的分支 + 我想在未来修改它

1) 我通过 composer remove hardevine/shoppingcart 从这个项目中删除了 hardevine 的 fork

2) 然后我修改了 fork 中的 composer.json:

  • 新名称:"name": "digital-bird/shoppingcart",
  • 新作者
  • 在要求下我添加了:"hardevine/shoppingcart": "dev-master",
  • 最后我添加了存储库部分:

⬇️

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/digital-bird/LaravelShoppingcart"
    }
],

我的 fork 的新 package.json 看起来像:https://github.com/digital-bird/LaravelShoppingcart/blob/master/composer.json

3) 我将其推送到我的 fork 的 master 分支

4) 我进入我的 Laravel 项目并输入:

composer require digital-bird/shoppingcart

我遇到了大红色错误:

[InvalidArgumentException] Could not find a matching version of package digital-bird/shoppingcart. Check the package spelling, your version constraint and that the package is ava ilable in a stability which matches your minimum-stability (stable).

我做错了什么?

最佳答案

你应该添加这个:

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/digital-bird/LaravelShoppingcart"
    }
],

到你的主要 Laravel 项目的 composer.json 而不是你的库。另外添加 "hardevine/shoppingcart": "dev-master", 似乎毫无意义,可能会产生一些冲突。

关于php - 无法在我的 Laravel 项目中使用分支存储库 - "Could not find a matching version of package",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56453369/

相关文章:

PHP - fatal error :未捕获错误:调用未定义的方法 PDO::statement()

git - Makefile:比较 git tag 和 package.json 中的两个版本字符串值

git - 使用git日志显示 merge 期间更改的文件

git - 压缩 merge 后接受默认的 git 提交消息

javascript - VueJS 组件

javascript - Krajee Bootstrap fileinput 如何动态更改 uploadExtraData

Java ip2long 等价物

php - Paypal 沙盒 API 状态

php - 在数据库种子期间禁用 Laravel 电子邮件

php - YouTube API-如何获取最近30天的 channel 观看次数