How to require a fork with composer?(如何要求作曲家的叉子?)
问题描述
这是我的 composer.json,我想在 Github 上使用 Nodge 的 lessphp 项目分支
This is my composer.json, I want to use Nodge's fork of lessphp project on Github
 "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 时出现此错误:
But I get this error when I run composer update:
点头/lessphp 开发大师->找不到匹配的包.
nodge/lessphp dev-master -> no matching package found.
我不知道如何正确地要求这个 fork.
I don't know how to require correctly this fork.
推荐答案
最常见(也是最简单)的方法是使用 VCS 存储库.
The most common (and easiest) way of doing it is using a VCS repository.
您所要做的就是将您的 fork 添加为存储库并更新版本约束指向您的自定义分支.您的自定义分支名称必须以dev-为前缀.
All you have to do is add your fork as a repository and update the version constraint to point to your custom branch. Your custom branch name must be prefixed with
dev-.
假设您修补了独白以修复错误修复分支中的错误:
Example assuming you patched monolog to fix a bug in the bugfix branch:
{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/igorw/monolog"
        }
    ],
    "require": {
        "monolog/monolog": "dev-bugfix"
    }
}
请注意,除了指定错误修复分支外,您不会更改 require 语句.你仍然引用上游包(monolog/monolog),不是你的个人分支(igorw/monolog).您可以在文档中阅读详细信息
Note that you don't change the require statement except to specify your bugfix branch. You still reference the upstream package (monolog/monolog), not your personal fork (igorw/monolog). You can read details in the docs
这篇关于如何要求作曲家的叉子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何要求作曲家的叉子?
 
				
         
 
            
        基础教程推荐
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- Web 服务器如何处理请求? 2021-01-01
- php中的foreach复选框POST 2021-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- 将变量从树枝传递给 js 2022-01-01
- php中的PDF导出 2022-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
 
    	 
    	 
    	 
    	 
    	 
    	 
    	 
    	 
				 
				 
				 
				