Skip to content

Using a different http adapter #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
scottgrayson opened this issue Nov 9, 2016 · 1 comment
Closed

Using a different http adapter #54

scottgrayson opened this issue Nov 9, 2016 · 1 comment

Comments

@scottgrayson
Copy link

I was getting no results using the default httpclient. so i am trying guzzle.

use GuzzleHttp\Client as GuzzleClient;
use Geocoder\Provider\Chain;
use Geocoder\Provider\BingMaps;
use Geocoder\Provider\FreeGeoIp;
use Geocoder\Provider\GoogleMaps;
use Geocoder\Provider\MaxMindBinary;

return [
    'providers' => [
        /*
        Chain::class => [
            GoogleMaps::class => [
                'en',
                'us',
                true,
                env('GOOGLE_MAPS_API_KEY'),
            ],
            FreeGeoIp::class  => [],
        ],
        BingMaps::class => [
            'en-US',
            env('BING_MAPS_API_KEY'),
        ],
         */
        GoogleMaps::class => [
            'en-US',
            'us',
            true,
            env('GOOGLE_MAPS_API_KEY'),
        ],
    ],
    'adapter'  => GuzzleClient::class,
];

error response:

TypeError: Argument 1 passed to Geocoder\Provider\GoogleMaps::__construct() must be an instance of Ivory\HttpAdapter\HttpAdapterInterface, instance of GuzzleHttp\Client given

/Users/Scott/Code/IOTM/vendor/willdurand/geocoder/src/Geocoder/Provider/GoogleMaps.php:59
@mikebronner
Copy link
Member

mikebronner commented Nov 23, 2016

You need to use one of the included Ivory HTTP adapters. In this case you would want to use Ivory\HttpAdapter\Guzzle6HttpAdapter. If you continue to have issues with this, please update here and reopen this issue. Hope this gets you and running, though. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants