gpt4 book ai didi

php - 如何需要 Composer 的 fork ?

转载 作者:行者123 更新时间:2023-12-03 04:21:04 24 4
gpt4 key购买 nike

这是我的composer.json,我想使用Nodge在Github上的lessphp项目的分支

 "repositories": [{
"type": "package",
"package": {
"version": "dev-master",
"name": "nodge/lessphp",
"source": {
"url": "https://github.com/Nodge/lessphp.git",
"type": "git",
"reference": "master"
},
"autoload": {
"classmap": ["lessc.inc.php"]
}
}
}],
"require": {
"php": ">=5.3.3",
"nodge/lessphp": "dev-master"
},

但是当我运行composer update时出现此错误:

nodge/lessphp dev-master -> no matching package found.

我不知道如何正确要求这个 fork 。

最佳答案

最常见(也是最简单)的方法是使用 VCS 存储库。

All you have to do is add your fork as a repository and update theversion constraint to point to your custom branch. Your custom branchname must be prefixed with dev-.

假设您 fork 了monolog/monolog并创建了一个名为bugfix的分支,您将像这样更新您的composer.json:

{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/igorw/monolog"
}
],
"require": {
"monolog/monolog": "dev-bugfix"
}
}

请注意,除了指定错误修复分支之外,您不要更改 require 语句。您仍然引用上游包 (monolog/monolog),而不是您的个人分支 (igorw/monolog),并且分支名称的前缀为dev-。您可以阅读详情in the docs

关于php - 如何需要 Composer 的 fork ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13498519/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com