FooBar
FooBar

Reputation: 6148

Requiring a fork in composer that other dependencies uses

I forked a project called PHPoAuthLib (https://github.com/canfiax/PHPoAuthLib)

PHPoAuthLib is being required by oauth-4-laravel (https://github.com/artdarek/oauth-4-laravel) - a package I require.

I have added this line in my composer.json file of my main project,

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/canfiax/PHPoAuthLib.git"
    }
],

My composer.lock file now has this:

    {
        "name": "lusitanian/oauth",
        "version": "v0.3.5",
        "source": {
            "type": "git",
            "url": "https://github.com/canfiax/PHPoAuthLib.git",
            "reference": "ac5a1cd5a4519143728dce2213936eea302edf8a"
        },
        "dist": {
            "type": "zip",
            "url": "https://api.github.com/repos/canfiax/PHPoAuthLib/zipball/ac5a1cd5a4519143728dce2213936eea302edf8a",
            "reference": "ac5a1cd5a4519143728dce2213936eea302edf8a",
            "shasum": ""
        },
        "require": {
            "php": ">=5.3.0"
        },
        "require-dev": {
            "phpunit/phpunit": "3.7.*",
            "predis/predis": "0.8.*@dev",
            "symfony/http-foundation": "~2.1"
        },
        "suggest": {
            "ext-openssl": "Allows for usage of secure connections with the stream-based HTTP client.",
            "predis/predis": "Allows using the Redis storage backend.",
            "symfony/http-foundation": "Allows using the Symfony Session storage backend."
        },
        "type": "library",
        "extra": {
            "branch-alias": {
                "dev-master": "0.1-dev"
            }
        },
        "autoload": {
            "psr-0": {
                "OAuth": "src",
                "OAuth\\Unit": "tests"
            }
        },
        "license": [
            "MIT"
        ],
        "authors": [
            {
                "name": "David Desberg",
                "email": "[email protected]"
            },
            {
                "name": "Pieter Hordijk",
                "email": "[email protected]"
            }
        ],
        "description": "PHP 5.3+ oAuth 1/2 Library",
        "keywords": [
            "authentication",
            "authorization",
            "oauth",
            "security"
        ],
        "support": {
            "source": "https://github.com/canfiax/PHPoAuthLib/tree/v0.3.5"
        },
        "time": "2014-09-05 15:19:58"
    },

So it does indeed fetch from my repo. But if you

However, my fork is not being implemented in the code. I think that this is because oauth-4-laravel requires version ~0.3.

How come my project does not fetch my fork?

UPDATE:

I went to check to see WHICH version it exactly fetches, and it fetches: "https://api.github.com/repos/canfiax/PHPoAuthLib/zipball/ac5a1cd5a4519143728dce2213936eea302edf8a" - that is not my commit. Why does it fetch ac5a1cd5a4519143728dce2213936eea302edf8a??

enter image description here

Upvotes: 1

Views: 644

Answers (1)

FooBar
FooBar

Reputation: 6148

Found the answer!

As described here: https://github.com/composer/composer/issues/3358 by @jakoch

"If other dependencies rely on the forked package, you could try to use an inline-alias, in order to make it match the constraint. https://getcomposer.org/doc/articles/aliases.md#require-inline-alias That's basically saying: Hey, other package (oauth-4-laravel) use my fork canfiax/PHPoAuthLib and it's dev-master branch (latest commit) as the version you expect (0.3.5-dev)."

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/canfiax/PHPoAuthLib"
        }
    ],
    "require": {
        "artdarek/oauth-4-laravel": "1.0.5",
        "lusitanian/oauth": "dev-master as 0.3.5-dev"
    },
    "minimum-stability": "dev"
}

Upvotes: 4

Related Questions