geocoder-php / GeocoderLaravel

Geocoder service provider for Laravel
http://geocoder-php.org/GeocoderLaravel/
MIT License
704 stars 102 forks source link

Chain unable to geocode address - Laravel 5.4 #67

Closed sahamilton closed 7 years ago

sahamilton commented 7 years ago

I started with a fresh install of Laravel (5.4.12) then added Geocoder

composer require toin0u/geocoder-laravel 

and tested with a route

Route::get('/geocode', function(){
    dd(app('geocoder')->geocode('Los Angeles, CA')->get());
});

Result is ChainNoResult

No provider could geocode address: "Los Angeles, CA".

added guzzle4.0

composer require "guzzlehttp/guzzle" "~4.0"

and changed adapter to Guzzle4HttpAdapter in geocoder.php

'adapter'  => Guzzle4HttpAdapter::class,

Added

use Ivory\HttpAdapter\Guzzle4HttpAdapter;

to geocoder.php

Succesfully geocoded.

mikebronner commented 7 years ago

You should be able to geocode with any of the adapters provided in https://github.com/geocoder-php/Geocoder. I would NOT recommend using the guzzle 4 adapter but instead use the Guzzle 6 adapter specified in the config file. Try a few of the addresses in the tests and see if you can resolve those: https://github.com/geocoder-php/GeocoderLaravel/blob/master/tests/Laravel5_3/Providers/GeocoderServiceTest.php

sahamilton commented 7 years ago

Mike

Thanks for checking and getting back to me. However I went through each of the adapters (Curl & Guzzle6) and neither will geocode. Again absolutely straight install of Laravel 5.4.12 and only geocoder added. Note that with 5.4 it is necessary to add guzzle to the requirements as without it the Guzzle6 adapter reports ‘Class 'GuzzleHttp\Client' not found ‘. Again from my research it is very clear that the issue lies with the adapters. Again the only way I have been able to make it work so far is by installing Guzzle 4.0 and updating geocoder accordingly. I certainly would like to be proved wrong.

Also you are probably aware that package egeloen/httpadapter has been abandoned and should be avoided (though I guess that’s a Will Durand package issue).

Stephen

From: Mike Bronner [mailto:notifications@github.com] Sent: Monday, February 20, 2017 1:33 PM To: geocoder-php/GeocoderLaravel GeocoderLaravel@noreply.github.com Cc: sahamilton stephen@crescentcreative.com; Author author@noreply.github.com Subject: Re: [geocoder-php/GeocoderLaravel] Chain unable to geocode address - Laravel 5.4 (#67)

You should be able to geocode with any of the adapters provided in https://github.com/geocoder-php/Geocoder. I would NOT recommend using the guzzle 4 adapter but instead use the Guzzle 6 adapter specified in the config file. Try a few of the addresses in the tests and see if you can resolve those: https://github.com/geocoder-php/GeocoderLaravel/blob/master/tests/Laravel5_3/Providers/GeocoderServiceTest.php

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geocoder-php/GeocoderLaravel/issues/67#issuecomment-281186028 , or mute the thread https://github.com/notifications/unsubscribe-auth/AFd3gPpIwCuB5HzmdfWfMxdeg2rqP3rSks5regaRgaJpZM4MGiC6 . https://github.com/notifications/beacon/AFd3gGbZKhpy7JQZI_liR262CxZHoG4Eks5regaRgaJpZM4MGiC6.gif

mikebronner commented 7 years ago

Yea, the outdated HTTP Adapters are an upstream issue and are already being replaced in the master branch (which is why I opted not to make the move on my own, even though I could -- I might pre-emt the parent release with an update, though).

If you have the config file published, that might be an issue. You MUST include the use statements for the respective Adapters and providers there. Please email me directly at mike-at-genealabs-dot-com if you would like me to take a look at your code via a screen-sharing session to see if we can't figure out what's happening.

mseymour commented 7 years ago

php 7.0.15, Laravel 5.4.15, geocoder-laravel 1.0.1. I've set the adapter to Guzzle 6, so far I haven't been able to geocode anything. Should dev-master work?

mikebronner commented 7 years ago

@mseymour Please open a new issue if none of the troubleshooting steps in the closed issue get it working. In my past experience this is down to system requirements not being met (outdated version of OpenSSL, for example).