如何在Composer中使用我的分支版本的repo?

时间:2016-03-01 06:22:35

标签: php git composer-php

我正在开发一个项目,最后不得不对我正在使用的其中一个软件包进行一些小改动。

那个包是:shopifyextras / shopify-php-api-wrapper
你可以在这里找到:https://github.com/ShopifyExtras/PHP-Shopify-API-Wrapper

我以前的composer.json文件看起来像这样:

{
    "require": {
        "monolog/monolog": "1.*",
        "shopifyextras/shopify-php-api-wrapper": "^1.1"
    },
    "autoload": {
        "psr-0": { "MyApp\\": "src/" }
    }
}

在分配仓库并进行更改之后(我忘了首先创建一个新分支,但是在提交到master之后创建了分支,并将其推送到github - 我不认为这会导致任何问题,因为分支存在,它确实指向正确的头部),然后我更新了我的composer.json以使用我的前叉。

在阅读作曲家文档(https://getcomposer.org/doc/05-repositories.md#vcs)后,我将composer.json更新为以下内容:

    {
"minimum-stability": "dev",
"prefer-stable" : true,
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/JonLaliberte/PHP-Shopify-API-Wrapper.git"
        }
    ],
    "require": {
        "monolog/monolog": "1.*",
        "shopifyextras/shopify-php-api-wrapper": "dev-risksbugfix"
    },
    "autoload": {
        "psr-0": { "MyApp\\": "src/" }
    }
}

当我运行composer update时,收到以下错误:

$ composer update --verbose
Loading composer repositories with package information
Updating dependencies (including require-dev)                                   
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package shopifyextras/shopify-php-api-wrapper 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.

我试过了:
使用“riskbugfix”而不是“dev-risksbugfix”
使用类型“vcs”而不是git“
从repo URL中删除“.git” 使用“jonlaliberte / shopify-php-api-wrapper”代替“shopifyextras / shopify-php-api-wrapper”

非常感谢任何帮助。谢谢!

1 个答案:

答案 0 :(得分:3)

<强> Branch Alias

  

如果您使用不可比较的版本(例如dev-develop),dev-必须使用别名   在分支名称前加上。

您的分支是不可比较的版本dev-riskbugfix

您可能需要在其前面添加dev-dev-dev-riskbugfix

或者将分支重命名为riskbugfix并删除dev-,然后别名为dev-riskbugfix

相关问题