composer-fallback/symfony.http-client-implementation.symfony

使用用户提供的包满足 "symfony/http-client-implementation",或者回退到 "symfony"。

1.1 2020-10-02 12:33 UTC

This package is auto-updated.

Last update: 2024-08-29 05:19:12 UTC


README

提供一个元包,用于需要 symfony/http-client-implementation 库的实现,当用户不满足初始要求时,回退到默认实现。

用法

composer require "composer-fallback/symfony.http-client-implementation.symfony:*"

Composer 将首选

  • 使用用户提供的实现
  • 否则,回退到 symfony/http-client

工作原理

此包包含 2 个版本

  1. 最高版本 1.1 不需要比您的要求更多的内容。

  2. 最低版本 1.0 会触发安装 symfony/http-client

当用户已有一个满足 symfony/http-client-implementation 的包时,Composer 将选择此最高版本。否则,Composer 将选择最低版本,并在这种情况下将下载以下包: symfony/http-client

它解决了什么问题?

您维护一个需要 symfony/http-client-implementation 实现的库,但您不希望指定特定的实现。

例如,您是以下 composer.json 的维护者

{
  "name": "acme/lib",
  "require": {
    "symfony/http-client-implementation": "^1.0",
  }
}

当最终用户使用以下代码要求您的库时

{
    "name": "end-user/app",
    "require": {
      "acme/lib": "^1.0"
    }
}

他们可能遇到以下错误

composer up

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for acme/lib ^1.0 -> satisfiable by acme/lib[1.0].
    - acme/lib 1.0 requires symfony/http-client-implementation ^1.0 -> no matching package found.

您可以要求用户安装一个随机的包,它会工作,但用户体验很差,一开始也很令人困惑。

通过使用 composer-fallback/symfony.http-client-implementation.symfony,用户将能够要求他们首选的实现或回退到您的默认选择

符合首选要求的用户示例

{
    "name": "end-user/app",
    "require": {
        "acme/lib": "^1.0",
        "third-party/provide-implementation": "^1.0"
    }
}
composer up
...
Package operations: 2 installs, 0 updates, 0 removals
  - Installing acme/lib (1.0)
  - Installing composer-fallback/symfony.http-client-implementation.symfony (1.1)

回退到您的推荐的用户示例

{
    "name": "end-user/app",
    "require": {
        "acme/lib": "^1.0"
    }
}
composer up
...
Package operations: 3 installs, 0 updates, 0 removals
  - Installing acme/lib (1.0)
  - Installing composer-fallback/symfony.http-client-implementation.symfony (1.0)
  - Installing symfony/http-client (1.0)

贡献

此存储库是自动生成的。如果您想贡献并提交问题或拉取请求,请使用 composer-fallback/generator