我正在开发一个项目,最终不得不对我正在使用的其中一个包进行一个小更改。
该包是: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/" }
}
}
fork 存储库并进行更改后(我忘记先创建一个新分支,但在提交到 master 后创建了该分支,并将其推送到 github - 我认为这不会导致任何问题,因为该分支存在并且它确实指向正确的头),然后我更新了我的composer.json以使用我的fork。
阅读 Composer 文档 ( 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 更新时,我收到以下错误:
$ 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“
从存储库 URL 中删除“.git”
使用“jonlaliberte/shopify-php-api-wrapper”而不是“shopifyextras/shopify-php-api-wrapper”
任何帮助将不胜感激。谢谢!
最佳答案
<强> 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
。
关于php - 如何在 Composer 中使用我的存储库的 fork 版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35716021/