【问题标题】:Requiring a fork in composer that other dependencies uses需要其他依赖项使用的作曲家中的分叉
【发布时间】:2014-12-11 04:09:53
【问题描述】:

我 fork 了一个名为 PHPoAuthLib (https://github.com/canfiax/PHPoAuthLib) 的项目

oauth-4-laravel (https://github.com/artdarek/oauth-4-laravel) 需要PHPoAuthLib - 我需要一个包。

我在我的主项目的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

为什么我的项目没有获取我的 fork?

更新:

我去查看它究竟获取了哪个版本,它获取的是:“https://api.github.com/repos/canfiax/PHPoAuthLib/zipball/ac5a1cd5a4519143728dce2213936eea302edf8a”——这不是我的承诺。为什么它会获取 ac5a1cd5a4519143728dce2213936eea302edf8a??

【问题讨论】:

    标签: git github version-control composer-php


    【解决方案1】:

    找到答案了!

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

    "如果其他依赖依赖于分叉包,您可以尝试使用内联别名,以使其与约束匹配。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"
    }
    

    【讨论】:

      猜你喜欢
      • 2015-02-27
      • 2017-04-22
      • 2018-09-23
      • 2014-03-10
      • 2019-12-02
      • 1970-01-01
      • 1970-01-01
      • 2016-09-23
      • 2015-01-11
      相关资源
      最近更新 更多