需要在其他依赖项使用的作曲家中使用fork

时间:2014-10-15 22:51:24

标签: git github version-control composer-php

我分叉了一个名为PHPoAuthLibhttps://github.com/canfiax/PHPoAuthLib

的项目 PHPoAuthLibhttps://github.com/artdarek/oauth-4-laravel)要求

oauth-4-laravel - 我需要的套餐。

我已将此行添加到我的主项目的composer.json文件中,

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

我的composer.lock文件现在有:

    {
        "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": "david@daviddesberg.com"
            },
            {
                "name": "Pieter Hordijk",
                "email": "info@pieterhordijk.com"
            }
        ],
        "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"
    },

所以它确实取自我的回购。但是如果你

但是,我的fork没有在代码中实现。我认为这是因为oauth-4-laravel需要版本~0.3

为什么我的项目不能取叉?

UPDATE:

我去查看它确切取出的WHICH版本,它取出:" https://api.github.com/repos/canfiax/PHPoAuthLib/zipball/ac5a1cd5a4519143728dce2213936eea302edf8a" - 那不是我的承诺。为什么要取ac5a1cd5a4519143728dce2213936eea302edf8a ??

enter image description here

1 个答案:

答案 0 :(得分:1)

找到了答案!

如此处所述:https://github.com/composer/composer/issues/3358来自@jakoch

"如果其他依赖项依赖于forked包,则可以尝试使用inline-alias,以使其与约束匹配。 https://getcomposer.org/doc/articles/aliases.md#require-inline-alias 这基本上是这样说的:嘿,其他包(oauth-4-laravel)使用我的fork canfiax / PHPoAuthLib和它的dev-master分支(最新提交)作为你期望的版本(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"
}