1010> If you still use ** Laravel 4** , please check out the ` 0.4.x ` branch
1111 [ here] ( https://github.com/geocoder-php/GeocoderLaravel/tree/0.4.x ) .
1212
13- ** Version 4.0.0 is a backwards-compatibility-breaking update. Please review
14- this documentation, especially the _ Usage_ section before installing.**
13+ ** Version 5.0.0 is a backwards-compatibility-breaking update. Please review
14+ the _ Upgrading_ section, especially the new default HTTP adapter, before
15+ installing.**
1516
1617This package allows you to use [ ** Geocoder** ] ( http://geocoder-php.org/Geocoder/ )
17- in [ ** Laravel 5 ** ] ( http://laravel.com/ ) .
18+ in [ ** Laravel** ] ( http://laravel.com/ ) .
1819
1920## Requirements
20- - PHP >= 7.1.3
21- - Laravel >= 5 .0
21+ - PHP >= 8.2
22+ - Laravel >= 11 .0
2223
2324## Installation
24251 . Install the package via composer:
@@ -120,10 +121,10 @@ However, you are free to add or remove providers as needed, both inside the
120121 Chain provider, as well as along-side it. The following is the default
121122 configuration provided by the package:
122123``` php
124+ use Geocoder\Laravel\Http\LaravelHttpClient;
123125use Geocoder\Provider\Chain\Chain;
124126use Geocoder\Provider\GeoPlugin\GeoPlugin;
125127use Geocoder\Provider\GoogleMaps\GoogleMaps;
126- use Http\Client\Curl\Client;
127128
128129return [
129130
@@ -173,16 +174,19 @@ return [
173174 | Adapter
174175 |--------------------------------------------------------------------------
175176 |
176- | You can specify which PSR-7-compliant HTTP adapter you would like to use.
177- | There are multiple options at your disposal: CURL, Guzzle, and others.
177+ | The HTTP adapter to use when communicating with geocoding services. By
178+ | default this package ships a PSR-18 client that delegates to Laravel's
179+ | `Http` facade — this gives you `Http::fake()` in tests, native retry
180+ | and timeout configuration, and any HTTP middleware you've registered.
178181 |
179- | Please consult the official Geocoder documentation for more info.
180- | https://github.com/geocoder-php/Geocoder#usage
182+ | Provide any class that implements `Psr\Http\Client\ClientInterface` to
183+ | swap in a different adapter (e.g., `Http\Client\Curl\Client` from
184+ | `php-http/curl-client`, which you would need to install separately).
181185 |
182- | Default: Client ::class (FQCN for CURL adapter)
186+ | Default: LaravelHttpClient ::class
183187 |
184188 */
185- 'adapter' => Client ::class,
189+ 'adapter' => LaravelHttpClient ::class,
186190
187191 /*
188192 |--------------------------------------------------------------------------
@@ -206,11 +210,18 @@ return [
206210```
207211
208212### Adapters
209- By default we provide a CURL adapter to get you running out of the box.
210- However, if you have already installed Guzzle or any other PSR-7-compatible
211- HTTP adapter, you are encouraged to replace the CURL adapter with it. Please
212- see the [ Geocoder Documentation] ( https://github.com/geocoder-php/Geocoder ) for
213- specific implementation details.
213+ By default we ship ` Geocoder\Laravel\Http\LaravelHttpClient ` , a thin PSR-18
214+ client that delegates every request to Laravel's ` Http ` facade. This means:
215+
216+ - ` Http::fake() ` and ` Http::assertSent() ` work in your tests with no extra setup
217+ - ` Http::timeout() ` , ` Http::retry() ` , ` Http::withMiddleware() ` , and any other
218+ Laravel HTTP client configuration applies to geocoder requests
219+ - One less third-party HTTP client to manage
220+
221+ If you need a different transport, set ` 'adapter' ` in ` config/geocoder.php ` to
222+ any class that implements ` Psr\Http\Client\ClientInterface ` . To go back to the
223+ previous CURL adapter, install ` php-http/curl-client ` and set
224+ ` 'adapter' => Http\Client\Curl\Client::class ` .
214225
215226### Customization
216227If you would like to make changes to the default configuration, publish and
@@ -263,6 +274,38 @@ Anytime you upgrade this package, please remember to clear your cache, to preven
263274php artisan cache:clear
264275```
265276
277+ ### 4.x to 5.x
278+ Update your ` composer.json ` :
279+ ``` json
280+ "toin0u/geocoder-laravel" : " ^5.0" ,
281+ ```
282+
283+ ** Breaking: default HTTP adapter changed.** The default ` 'adapter' ` in
284+ ` config/geocoder.php ` is now ` Geocoder\Laravel\Http\LaravelHttpClient `
285+ instead of ` Http\Client\Curl\Client ` . The new adapter is a PSR-18 client
286+ that delegates to Laravel's ` Http ` facade, so ` Http::fake() ` , retries,
287+ timeouts, and middleware all work transparently.
288+
289+ If you have ** published the geocoder config previously** , your config file
290+ still pins the old curl adapter and will fail at runtime once
291+ ` php-http/curl-client ` is no longer installed. Pick one:
292+
293+ - ** Recommended:** delete (or rename) your published ` config/geocoder.php `
294+ and re-publish it, then re-apply your customizations.
295+ - Or edit the existing file: change ` use Http\Client\Curl\Client; ` to
296+ ` use Geocoder\Laravel\Http\LaravelHttpClient; ` and change
297+ ` 'adapter' => Client::class ` to ` 'adapter' => LaravelHttpClient::class ` .
298+ - Or, if you want to keep the curl adapter, install it explicitly:
299+ ` composer require php-http/curl-client ` . The published config keeps working
300+ unchanged.
301+
302+ ** Other notable changes in 5.x:**
303+ - Minimum PHP raised to 8.2; minimum Laravel raised to 11.x.
304+ - ` php-http/curl-client ` removed from required dependencies (install it
305+ yourself if you still need it).
306+ - ` MaxMindBinary ` provider support removed (the underlying PHP package was
307+ abandoned). Use ` geocoder-php/geoip2-provider ` for MaxMind data instead.
308+
266309### 1.x to 4.x
267310Update your composer.json file:
268311``` json
0 commit comments