geocoder-php / GeocoderLaravel

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

Class Geocoder\Provider\Chain does not exist #142

Closed jmichaelterenin closed 5 years ago

jmichaelterenin commented 5 years ago

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

/**

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!

mikebronner commented 5 years ago

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

jmichaelterenin commented 5 years ago

Mike, you rock! Fastest responder I've ever seen on any github packages. Thank you very much, and even more for the package itself.

mikebronner commented 5 years ago

@jmichaelterenin Awesome, glad that fixed it! :)

jmichaelterenin commented 5 years ago

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.

mikebronner commented 5 years ago

@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

jmichaelterenin commented 5 years ago

I know that, that's what I mean. Wrapping things go a long way in keeping things clean. it really does.