Symfony 2.8 - Ivory Google Maps Bundle - “ivory_google_map”下无法识别的选项“api_key”

Symfony 2.8 - Ivory Google Maps Bundle - Unrecognized option “api_key” under “ivory_google_map”

我已关注 master documentation 并尝试通过 运行 下载它的捆绑包版本:

$ composer require egeloen/google-map-bundle

但不幸的是它下载了 2.2 版本的捆绑包。我认为这是正确的版本,但事实并非如此。当我进一步按照文档进行操作时,将其添加到 config.yml:

后出现配置错误
ivory_google_map:
    api_key: "%api_key%"

错误说:

Unrecognized option “api_key” under “ivory_google_map”

Here 创作者说:

Let me explain your issue, when refering to https://github.com/egeloen/IvoryGoogleMapBundle/blob/master/Resources/doc/service/distance_matrix.md#api-key you're refering to dev-master doc whereas if you're using the 2.2.1 version, you should use: https://github.com/egeloen/IvoryGoogleMapBundle/blob/2.2.1/Resources/doc/usage/services/distance_matrix/distance_matrix.md

Unfortunatelly for you, the api key support has only been added on master, so if you want to take benefit of it, you will need to upgrade.

好的,所以我 100% 确定我遵循的文档安装下载了错误的版本,我必须升级它。但是怎么办?

我试过了运行:

$ composer require egeloen/google-map-bundle dev-master

我得到一个错误:

Problem 1
- Installation request for egeloen/google-map-bundle dev-master -> satisfiable by egeloen/google-map-bundle[dev-master].
- egeloen/google-map-bundle dev-master requires egeloen/google-map ^2.0@dev -> satisfiable by egeloen/google-map[2.0.x-dev] but these conflict with your requirements or minimum-stability.

^2.0@dev 也没有解决我的问题。请问有人可以帮忙吗?我找不到任何符合这个问题的文章。

Composer 有一个名为 minimum-stability 的选项,默认设置为 stable。这意味着当您 运行 composer installcomposer update 时,作曲家将只接受正确标记的版本。

如果您想使用供应商的 dev-master,您必须在 composer.json 中将 minimum-stability 选项设置为 dev

{
    "name": "myproject",
    ...
    "require": {
        ...
    },
    "require-dev": {
        ...
    },
    "minimum-stability": "dev",
    ...
}

请注意,这可能会导致在您的项目中安装不稳定版本的供应商,因此请尽可能避免这种情况。您还可以通过设置供应商的版本来防止这种情况发生,以确保使用特定的标签,但是您必须手动检查供应商更新。