2016-03-01 55 views
2

我正在開發一個項目,最後不得不對我正在使用的軟件包中的一個進行小改動。如何在Composer中使用我的分叉版本的回購?

這包是:shopifyextras/shopify-PHP-API包裝
,你可以在這裏找到: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/" } 
    } 
} 

分叉的後回購和做我的更改(我忘了先創建一個新的分支,但在承諾掌握後創建了分支,並將其推送到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 --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. 

我曾嘗試:
使用「risksbugfix」而不是「dev-risksbugfix」
使用類型「vcs」而不是git「
Remov荷蘭國際集團 「git的」 從回購URL
使用 「jonlaliberte/shopify-PHP-API的包裝」,而不是 「shopifyextras/shopify-PHP-API包裝」

任何幫助將不勝感激。謝謝!

+1

使用'dev-master'而不是'dev-risksbugfix'嘗試它,同時保留手冊 – codisfy

+1

「dev-」中提及的'repositories'配置和正確的存儲庫URI(在.git結束)應該訣竅。也許是因爲你的branchname完全是「dev-riskbugfix」而不僅僅是「riskbugfix」? – paskl

+0

@codeHeart好吧,這樣做的伎倆,謝謝!我有點困惑,爲什麼其他分支不工作,但?該手冊說要使用一個單獨的分支(我應該從頭開始完成),並按照問題描述('dev- ')中提到的方式引用它。它似乎只在使用私人回購時引用'dev-master'。 – Jonathan

回答

3

Branch Alias

If you alias a non-comparable version (such as dev-develop) dev- must prefix the branch name.

您分支dev-riskbugfix非可比的版本。

您可能需要使用dev-dev-dev-riskbugfix作爲其前綴。

或者將分支重新命名爲riskbugfix並刪除dev-,則別名將爲dev-riskbugfix

相關問題