我已Symfony Demo Application启动并运行,现在我正在尝试install API Platform as a standalone bundle。
我使用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.
答案 0 :(得分:4)
在composer.json
文件中:
查找
"symfony/symfony": "3.2.*",
替换为:
"symfony/symfony": "3.3.*",
...或:
"symfony/symfony": "^3.2.*",
您可能首先需要(想要)运行composer update
,然后使用composer require api-platform/core
添加您的api-platform软件包,以便正确加载所有依赖项,但它已经加载了不是必需的。
答案 1 :(得分:1)
使用PHP 7.x,您应该使用^2.0
,例如
composer require api-platform/core ^2.0
注意:要解决PHP 7.x要求,可以尝试添加--ignore-platform-reqs
。
如果您收到有关minimum-stability
的错误,请将其更改为beta
文件中的composer.json
。
来源:Compatibility issue when using composer require with symfony 3.1.4 at GitHub。