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
这篇关于如何要求作曲家的叉子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何要求作曲家的叉子?
基础教程推荐
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 如何替换eregi() 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
