Search code examples
google-mapssymfonygoogle-maps-api-3api-key

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


I have followed master documentation and tried to download it's version of bundle by running:

$ composer require egeloen/google-map-bundle

But unfortunatelly it downloaded 2.2 version of a bundle. I would think that this is correct version, but it is not. When I follow the documentation further I get an error in configuration after adding this to config.yml:

ivory_google_map:
    api_key: "%api_key%"

Error says:

Unrecognized option “api_key” under “ivory_google_map”

Here creator says:

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.

Okay so I am 100% sure that documentation installation I followed downloaded wrong version and I have to upgrade it. But how?

I tried running:

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

And I got an error:

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 does not solve my problem either. Please can anyone help? I cannot find any articles according this problem.


Solution

  • Composer has an option called minimum-stability that is set by default to stable. This means that when you run composer install or composer update, composer will only accept properly tagged versions.

    If you want to use the dev-master of a vendor, you will have to set the minimum-stability option to dev in your composer.json :

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

    Be aware that this could lead to non-stable versions of vendors being installed in your project, so this is to avoid when you can. You can also prevent this by setting the version of your vendors to be sure a specific tag will be used, but then you would have to check your vendors update manually.