Haris Mehmood
Haris Mehmood

Reputation: 902

Use forked repo on github via composer as dependency

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

  1. socialnick/scn-social-auth

Which further depends upon

  1. hybridauth/hybridauth

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

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.

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

Upvotes: 1

Views: 317

Answers (1)

danopz
danopz

Reputation: 3408

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"
        }
    ]
}

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",

Reference blog post from mnapoli

Upvotes: 1

Related Questions