关于php:但是这些与您的要求或最低稳定性冲突

But these conflict with your requirements or minimum-stability

嗨,当我尝试安装SparkPost PHP库时遇到了这个问题:

Problem 1
- The requested package sparkpost/sparkpost No version set (parsed as 1.0.0) is satisfiable by sparkpost/sparkpost[No version set (parsed
as 1.0.0)] but these conflict with your requirements or
minimum-stability.

当我尝试执行此命令时出现:
composer require sparkpost/sparkpost


完整的控制台输出:

1
2
3
4
5
6
7
8
9
10
11
12
You are running Composer with SSL/TLS protection disabled.
Using version ^2.0 for sparkpost/sparkpost
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package sparkpost/sparkpost No version set (parsed as 1.0.0) is satisfiable by sparkpost/sparkpost[No version set (parsed as 1.0.0)] but these conflict with your requirements or minimum-stability.


Installation failed, reverting ./composer.json to its original content.

作曲者档案:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
 "name":"sparkpost/sparkpost",
 "description":"Client library for interfacing with the SparkPost API.",
 "license":"Apache 2.0",
 "authors": [
    {
     "name":"SparkPost"
    }
  ],
 "minimum-stability":"stable",
 "scripts": {
   "post-install-cmd":"post-install.sh",
   "post-update-cmd":"post-install.sh",
   "test":"./vendor/bin/phpunit",
   "fix-style":"php-cs-fixer fix ."
  },
 "require": {
   "php":"^5.6 || ^7.0",
   "php-http/httplug":"^1.0",
   "php-http/message":"^1.0",
   "php-http/client-implementation":"^1.0",
   "php-http/discovery":"^1.0",
   "php-http/guzzle6-adapter":"^1.1",
   "guzzlehttp/guzzle":"^6.2"
  },
 "require-dev": {
   "phpunit/phpunit":"^4.8 || ^5.4",
   "mockery/mockery":"^0.9.4",
   "friendsofphp/php-cs-fixer":"^1.11",
   "nyholm/nsa":"^1.0",
   "satooshi/php-coveralls":"dev-master",
   "phpunit/phpcov":"2.*"
  },
 "autoload": {
   "psr-4": {
     "SparkPost\\":"lib/SparkPost"
    }
  },
 "autoload-dev": {
   "psr-4": {
     "SparkPost\\\\Test\\":"test/unit"
    }
  }
}

有什么办法吗?


PD:我尝试将"minimum-stability":"stable"设置为"dev",但是我遇到了相同的错误


您可以在composer.json中将其定义为:

1
"some-vendor/some-library":"@dev"

那应该推翻稳定性设定。


如果您的项目没有版本,则应指定要求开发的版本,例如:

1
composer require sparkpost/sparkpost --dev

要么:

1
composer require sparkpost/sparkpost:dev-master

您可以在composer.json中指定version,然后为该版本创建标签(git tag)。

另请参阅:如何使用Composer安装没有版本的软件包(仅限主版本)