本文介绍了Composer - 未找到匹配的包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了一个 PHP 框架,我正在尝试将所有内容分成不同的存储库并在 composer 中进行设置,以使我的生活更轻松.

I have a PHP framework I've built, and I'm trying to separate everything into different repos and get it set up in composer to make my life easier.

基本上,我有 3 个有问题的存储库:一个用于作为集合数据类型基类的集合类(liftkit/collection"),另一个是输入变量的包装器(liftkit/input",这取决于集合 repo),第三个用于核心(liftkit/core",这取决于输入包装器.

Basically, I have 3 repos in question: one is for a collection class that serves as a base class for collection data types ("liftkit/collection"), another is a wrapper for input variables ("liftkit/input", which depends on the collection repo), and a third that is for the core ("liftkit/core", which depends on the input wrapper.

当我在liftkit/input"上运行 composer update 时,它会安装liftkit/collection"并且工作正常,但是当我在liftkit/core"上运行它时,它会给我以下错误:

When I run composer update on "liftkit/input", it installs "liftkit/collection" and works fine, but when I run it on "liftkit/core" it gives me the following error:

问题 1- liftkit/input @dev 的安装请求 -> liftkit/input[dev-master] 可满足.- liftkit/input dev-master 需要 liftkit/collection dev-master -> 找不到匹配的包.

这是我的 composer.json 文件:

Here are my composer.json files:

{
    "name": "liftkit/collection",
    "description": "LiftKit base class for collections",
    "license": "LGP-2.1",
    "autoload": {
        "psr-4": {
            "LiftKit\": "src/"
        }
    },
    "require": {
    },
    "require-dev": {
        "phpunit/phpunit": "4.5.*"
    }
}

{
    "name": "liftkit/input",
    "description": "LiftKit input wrappers",
    "license": "LGP-2.1",
    "autoload": {
        "psr-4": {
            "LiftKit\": "src/"
        }
    },
    "require": {
        "liftkit/collection": "dev-master"
    },
    "require-dev": {
        "phpunit/phpunit": "4.5.*"
    },
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/liftkit/collection"
        }
    ]
}

{
    "name": "liftkit/core",
    "description": "LiftKit Core Libraries",
    "license": "LGP-2.1",
    "minimum-stability": "dev",
    "autoload": {
        "psr-4": {
            "LiftKit\": "src/"
        }
    },
    "require": {
        "liftkit/input": "dev-master",
        "liftkit/dependency-injection": "dev-master"
    },
    "require-dev": {
        "phpunit/phpunit": "4.5.*"
    },
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/liftkit/input"
        },
        {
            "type": "git",
            "url": "https://github.com/liftkit/dependency-injection"
        }
    ]
}

非常感谢任何帮助.谢谢.

Any help is greatly appreciated. Thanks.

推荐答案

看起来 composer 不会递归地解析存储库.来自文档:

Looks like composer won't resolve repositories recursively. From the docs:

存储库不是递归解析的.您只能将它们添加到你的主要 composer.json.依赖关系的存储库声明'composer.jsons 被忽略.

所以我想我运气不好.我必须在每个 repo 中指定存储库.

So I guess I'm out of luck. I'll have to specify the repositories in each repo.

这篇关于Composer - 未找到匹配的包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-24 09:47