库需要“dev-master”和稳定版本

时间:2018-02-05 17:08:01

标签: php composer-php

我正在为框架(atk4 / data)开发一个附加组件(atk4 / audit)。我的基本composer.json看起来像这样:

{
    "type": "library",
    "name": "atk4/audit",
    "require": {
        "atk4/data": "^1.3",
        "php": ">=5.6.0"
    }
}

这很好用,如果使用composer require atk4/audit,则安装atk4 / audit [1.0]和atk4 / data [1.3]。

但是,当尝试使用开发分支时:

{
    "require": {
        "atk4/data": "dev-develop",
        "myaddon/addon": "dev-develop"
    }
}

作曲家回应错误:

Problem 1
  - Installation request for atk4/data dev-develop -> satisfiable by atk4/data[dev-develop].
  - atk4/data dev-develop requires atk4/dsql dev-develop -> satisfiable by atk4/dsql[dev-develop] but these conflict with your requirements or minimum-stability.
Problem 2
  - Installation request for atk4/audit dev-develop -> satisfiable by atk4/audit[dev-develop].
  - atk4/audit dev-develop requires atk4/schema dev-develop -> satisfiable by atk4/schema[dev-develop] but these conflict with your requirements or minimum-stability.

我希望我的库可用于“稳定”和“开发”版本。我已尝试为此库设置composer.json这样的内容:

{
    "type": "library",
    "name": "atk4/audit",
    "require": {
        "atk4/data": "dev-develop,^1.3",
        "php": ">=5.6.0"
    }
}

但是,这不起作用。我在任何地方都没有发现任何这个问题,我想知道我是否走错了路?

1 个答案:

答案 0 :(得分:3)

使用Composer定义不稳定的依赖关系时,需要指定最小稳定性。

{
    "require": {
        "atk4/data": "dev-develop",
        "myaddon/addon": "dev-develop"
    },
    "minimum-stability": "dev"
}

您还应添加"prefer-stable": true,否则composer.json中的所有非版本化软件包都将更新为不稳定分支。