通过 composer 在 github 上使用 forked repo 作为依赖 [英] Use forked repo on github via composer as dependency

查看:26
本文介绍了通过 composer 在 github 上使用 forked repo 作为依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 socalnick/scn-social-auth-doctrine-orm 的项目.该模块进一步依赖于:

I have a project that uses socalnick/scn-social-auth-doctrine-orm. This module further depends upon:

  1. socialnick/scn-social-auth

这进一步取决于

  1. hybridauth/hybridauth

所以 ORM 取决于->Social-Auth 这取决于->混合

So ORM Depends on->Social-Auth which depends on->Hybrid

为了使我的应用程序能够正常工作,我需要对这两个模块 (1) 和 (2) 进行一些更改.我将这些模块分叉到我的 git 帐户中,并根据我的要求进行了更改.在我的应用程序 composer.json 中,我只是将 socalnick/scn-social-auth-doctrine-orm 作为要求.

In order for my application to work, I required some changes in these two modules (1) and (2). I forked these modules to my git account and made changes as per my requirement. In my application composer.json I am just putting socalnick/scn-social-auth-doctrine-orm as requirement.

我如何管理 composer.json 以便 socalnick/scn-social-auth-doctrine-orm 获得我的分叉模块而不是默认模块.

How can I manage composer.json so that socalnick/scn-social-auth-doctrine-orm get my forked modules instead of default modules.

推荐答案

您应该在 composer.json 中覆盖该依赖项.

You should override that dependencies in your composer.json.

{
    "require": {
        "socalnick/scn-social-auth-doctrine-orm": "*",
        "socialnick/scn-social-auth": "*",
        "hybridauth/hybridauth": "*"
    },
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/USER/scn-social-auth.git"
        },
        {
            "type": "git",
            "url": "https://github.com/USER/hybridauth.git"
        }
    ]
}

在你的 fork 中,你可以添加一个匹配主包要求的标签,或者使用带有版本号别名的分支:

In your fork you could add a tag that matches the requirements of the main package, or use a branch with a version number alias:

"socialnick/scn-social-auth": "dev-mybranch as 2.1.0",

参考来自 mnapoli 的博文

这篇关于通过 composer 在 github 上使用 forked repo 作为依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆