Class Geocoder\Provider\Chain does not exist
jmichaelterenin opened this issue · 6 comments
General Information
GeocoderLaravel Version: 4.0
Laravel Version: 5.7.9
PHP Version: 7.1.8
Operating System and Version:
Windows 10
Issue Description
I recently upgraded to Laravel 5.7 from 5.5, where there were no issues.
try { $geo_address = $this->getAddressFormat(); $geocode = app('geocoder')->geocode($geo_address)->get(); // The GoogleMapsProvider will return a result return $geocode->first(); } catch (\Exception $e) { // Exception will be thrown here return $e->getMessage(); }
I've republished my config file and cleared my cache (php artisan cache:clear) a number of times.
Here's my config file:
`<?php
/**
- This file is part of the GeocoderLaravel library.
- (c) Antoine Corcy contact@sbin.dk
- For the full copyright and license information, please view the LICENSE
- file that was distributed with this source code.
*/
use Ivory\HttpAdapter\CurlHttpAdapter;
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
use Geocoder\Provider\Chain;
use Geocoder\Provider\BingMaps;
use Geocoder\Provider\FreeGeoIp;
use Geocoder\Provider\GoogleMaps;
use Geocoder\Provider\Nominatim;
use Geocoder\Provider\MaxMindBinary;
return [
'cache-duraction' => 999999999,
'providers' => [
Chain::class => [
BingMaps::class => [
env('BING_MAPS_API_KEY'),
'en-US',
],
GoogleMaps::class => [
'en',
'us',
true,
env('GOOGLE_MAPS_API_KEY'),
],
Nominatim::class => [
'https://nominatim.openstreetmap.org',
'en',
],
],
BingMaps::class => [
env('BING_MAPS_API_KEY'),
'en-US',
],
GoogleMaps::class => [
'en',
'us',
true,
env('GOOGLE_MAPS_API_KEY'),
],
],
'adapter' => CurlHttpAdapter::class,
];
`
I apologize, I never did get a full grasp on this Markdown syntax. I appreciate your help!
It looks like you didn't overwrite your config file (you need to force publish if it already exists). Please compare to here: https://github.com/geocoder-php/GeocoderLaravel/blob/master/config/geocoder.php
Mike, you rock! Fastest responder I've ever seen on any github packages. Thank you very much, and even more for the package itself.
@jmichaelterenin Awesome, glad that fixed it! :)
Yes, and the config file is way cleaner now, along with the install/utilization of other Providers like BingMaps (which I included). Again, well done Mike. Really.
@jmichaelterenin Thanks ... but I'm really only wrapping the package for Laravel, someone else has been working on the core package. :) https://github.com/geocoder-php/Geocoder
I know that, that's what I mean. Wrapping things go a long way in keeping things clean. it really does.