如何在没有 flex 的情况下在现有的 symfony 3.4 应用程序中安装 api-platform?

How to install api-platform in existing symfony 3.4 application without flex?

我尝试在现有的 Symfony 3.4 应用程序上安装 api-platform,它没有安装 flex。

当我尝试使用 composer require api-platform/core 安装它时,发生错误:

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
    - Conclusion: don't install api-platform/core v2.4.3
    - Conclusion: don't install api-platform/core v2.4.2
    - Conclusion: don't install api-platform/core v2.4.1
    - Conclusion: remove symfony/symfony v3.4.21
    - Installation request for api-platform/core ^2.4 -> satisfiable by api-platform/core[v2.4.0, v2.4.1, v2.4.2, v2.4.3].
    - Conclusion: don't install symfony/symfony v3.4.21
    - api-platform/core v2.4.0 requires symfony/web-link ^4.1 -> satisfiable by symfony/web-link[v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.0, v4.2.1, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8].
    - don't install symfony/web-link v4.1.0|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.1.1|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.1.10|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.1.11|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.1.12|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.1.2|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.1.3|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.1.4|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.1.5|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.1.6|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.1.7|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.1.8|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.1.9|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.2.0|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.2.1|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.2.2|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.2.3|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.2.4|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.2.5|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.2.6|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.2.7|don't install symfony/symfony v3.4.21
    - don't install symfony/web-link v4.2.8|don't install symfony/symfony v3.4.21
    - Installation request for symfony/symfony 3.4.21 -> satisfiable by symfony/symfony[v3.4.21].


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

这是我当前的作曲家要求(和要求开发)部分:

    "require": {
        "php": ">=7.2",
        "ext-curl": "*",
        "ext-exif": "*",
        "ext-json": "*",
        "accord/mandrill-swiftmailer-bundle": "^1.3",
        "beberlei/DoctrineExtensions": "^1.0",
        "braincrafted/bootstrap-bundle": "^2.2",
        "bukashk0zzz/hellosign-bundle": "^1.0",
        "callr/sdk-php": "^0.11.1",
        "doctrine/doctrine-bundle": "^1.6",
        "doctrine/doctrine-migrations-bundle": "^1.3",
        "doctrine/orm": "^2.5",
        "dopiaza/slack-exception-logger-bundle": "^2.0",
        "facebook/graph-sdk": "^5.6",
        "friendsofsymfony/oauth-server-bundle": "^1.6",
        "friendsofsymfony/rest-bundle": "^2.3",
        "friendsofsymfony/user-bundle": "2.0.*",
        "google/apiclient": "^2.2",
        "google/cloud-storage": "^1.10",
        "hpatoio/bitly-bundle": "^1.0",
        "incenteev/composer-parameter-handler": "^2.0",
        "jms/serializer-bundle": "^2.3",
        "knplabs/knp-paginator-bundle": "^2.7",
        "liip/imagine-bundle": "^1.9",
        "nelmio/api-doc-bundle": "^3.3",
        "nelmio/cors-bundle": "^1.5",
        "phobetor/rabbitmq-supervisor-bundle": "^3.1",
        "php-amqplib/rabbitmq-bundle": "^1.14",
        "predis/predis": "^1.1",
        "sensio/distribution-bundle": "^5.0.19",
        "sensio/framework-extra-bundle": "^5.0.0",
        "sentry/sentry-symfony": "^2.0",
        "snc/redis-bundle": "^2.0",
        "stof/doctrine-extensions-bundle": "^1.3",
        "symfony/assetic-bundle": "^2.8",
        "symfony/monolog-bundle": "^3.1.0",
        "symfony/polyfill-apcu": "^1.0",
        "symfony/swiftmailer-bundle": "^2.6.4",
        "symfony/symfony": "3.4.21",
        "twig/extensions": "^1.5",
        "twig/twig": "^1.0||^2.0"
    },
    "require-dev": {
        "brianium/paratest": "^1.1",
        "doctrine/doctrine-fixtures-bundle": "^3.0",
        "escapestudios/symfony2-coding-standard": "3.x-dev",
        "friendsofphp/php-cs-fixer": "^2.14",
        "liip/functional-test-bundle": "^1.9",
        "phpmd/phpmd": "^2.6",
        "phpunit/phpunit": "^6",
        "sensio/generator-bundle": "^3.1",
        "squizlabs/php_codesniffer": "*",
        "symfony/phpunit-bridge": "^4.0"
    },

我找不到任何方法来解决我的问题,作曲家的错误也不是很明确,所以我不明白我错过了什么。

看起来 api-platform/core ^2.4symfony/symfony v3.4.21 不兼容,因为它需要 symfony/web-link v4.1.0 并且我很确定所有 symfony v4 分支包都适用于 symfony 4,请尝试使用 api-platform/core v2.2 它似乎对任何严格的 v4 分支包没有任何依赖性。 https://github.com/api-platform/core/blob/2.2/composer.json