简体   繁体   English

通过composer在github上使用fork repo作为依赖

[英]Use forked repo on github via composer as dependency

I have a project that uses socalnick/scn-social-auth-doctrine-orm .我有一个使用socalnick/scn-social-auth-doctrine-orm 的项目 This module further depends upon:该模块进一步取决于:

  1. socialnick/scn-social-auth socialnick/scn-social-auth

Which further depends upon这进一步取决于

  1. hybridauth/hybridauth混合认证/混合认证

So ORM Depends on-> Social-Auth which depends on-> Hybrid所以ORM依赖于-> Social-Auth依赖于-> Hybrid

In order for my application to work, I required some changes in these two modules (1) and (2).为了让我的应用程序正常工作,我需要对这两个模块 (1) 和 (2) 进行一些更改。 I forked these modules to my git account and made changes as per my requirement.我将这些模块分叉到我的 git 帐户并根据我的要求进行了更改。 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 以便socalnick/scn-social-auth-doctrine-orm获取我的分叉模块而不是默认模块。

You should override that dependencies in your composer.json .您应该在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"
        }
    ]
}

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:在你的 fork 中,你可以添加一个符合主包要求的标签,或者使用一个带有版本号别名的分支:

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

Reference blog post from mnapoli来自 mnapoli 的参考博客文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM