3

我已经启动并运行了Symfony 演示应用程序,现在我正在尝试将 API 平台安装为独立包

我正在使用 PHP 7.0.10 和最新的作曲家,但我之前的测试是使用 PHP 5.6.20。

当我尝试将 API Platform Core 添加为依赖项时,我收到以下错误消息:

$ composer require api-platform/core
Using version ^1.1 for api-platform/core
./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
    - Installation request for symfony/symfony (locked at v3.2.8, required as ^3
.2) -> satisfiable by symfony/symfony[v3.2.8].
    - api-platform/core v1.1.0 requires phpdocumentor/reflection ^1.0.7 -> satis
fiable by phpdocumentor/reflection[1.0.7].
    - api-platform/core v1.1.1 requires phpdocumentor/reflection ^1.0.7 -> satis
fiable by phpdocumentor/reflection[1.0.7].
    - Conclusion: don't install phpdocumentor/reflection 1.0.7
    - Installation request for api-platform/core ^1.1 -> satisfiable by api-plat
form/core[v1.1.0, v1.1.1].


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

2 回答 2

4

在您的composer.json文件中:

寻找:

"symfony/symfony": "3.2.*",

用。。。来代替:

"symfony/symfony": "3.3.*",

...或者:

"symfony/symfony": "^3.2.*",

您可能需要(想要)首先运行composer update,然后添加您的 api-platform 包,composer require api-platform/core以便正确加载所有依赖项,但这不是必需的。

于 2017-05-19T20:52:42.027 回答
1

使用 PHP 7.x,您应该使用^2.0,例如

composer require api-platform/core ^2.0

注意:要解决 PHP 7.x 要求,您可以尝试添加--ignore-platform-reqs.

如果您收到关于 的错误minimum-stability,请将其更改为beta在您的composer.json文件中。

来源:在 GitHub 上使用 composer require 和 symfony 3.1.4 时的兼容性问题

请参阅:安装 API 平台核心

于 2018-03-25T15:13:02.897 回答