Skip to content

Commit 7bbf368

Browse files
authored
Update README.md
1 parent bc9acf3 commit 7bbf368

File tree

1 file changed

+86
-77
lines changed

1 file changed

+86
-77
lines changed

README.md

Lines changed: 86 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -34,79 +34,16 @@ This package allows you to use [**Geocoder**](http://geocoder-php.org/Geocoder/)
3434
Geocoder\Laravel\Providers\GeocoderService::class,
3535
// ];
3636
```
37-
38-
## Upgrading
39-
Anytime you upgrade this package, please remember to clear your cache, to prevent incompatible cached responses when breaking changes are introduced (this should hopefully only be necessary in major versions):
40-
```sh
41-
php artisan cache:clear
42-
```
43-
44-
### 1.x to 4.x
45-
Update your composer.json file:
37+
3. **Optional** I recommend adding the following lines to your `composer.json` file to prevent stale caches when upgrading or updating the package, both in your live and dev environments:
4638
```json
47-
"toin0u/geocoder-laravel": "^4.0",
39+
"post-update-cmd": [
40+
"@php artisan cache:clear",
41+
],
42+
"post-install-cmd": [
43+
"@php artisan cache:clear",
44+
]
4845
```
4946

50-
The one change to keep in mind here is that the results returned from
51-
`Geocoder for Laravel` are now using the Laravel-native Collections class
52-
instead of returning an instance of `AddressCollection`. This should provide
53-
greater versatility in manipulation of the results, and be inline with
54-
expectations for working with Laravel. The existing `AddressCollection`
55-
methods should map strait over to Laravel's `Collection` methods. But be sure
56-
to double-check your results, if you have been using `count()`,
57-
`first()`, `isEmpty()`, `slice()`, `has()`, `get()`, or `all()` on your results.
58-
59-
Also, `getProviders()` now returns a Laravel Collection instead of an array.
60-
61-
**Alert:** if you have been using the `getIterator()` method, it is no longer
62-
needed. Simply iterate over your results as you would any other Laravel
63-
collection.
64-
65-
**Deprecated:**
66-
- the `all()` method on the geocoder is being deprecated in favor of using
67-
`get()`, which will return a Laravel Collection. You can then run `all()`
68-
on that. This method will be removed in version 5.0.0.
69-
- the `getProvider()` method on the geocoder is being deprecated in favor of using
70-
`getProviders()`, which will return a Laravel Collection. You can then run `first()`
71-
on that to get the same result. This method will be removed in version 5.0.0.
72-
73-
**Added:** this version introduces a new way to create more complex queries:
74-
- geocodeQuery()
75-
- reverseQuery()
76-
77-
Please see the [Geocoder documentation](https://github.com/geocoder-php/Geocoder)
78-
for more details.
79-
80-
### 0.x to 1.x
81-
If you are upgrading from a pre-1.x version of this package, please keep the
82-
following things in mind:
83-
84-
1. Update your composer.json file as follows:
85-
86-
```json
87-
"toin0u/geocoder-laravel": "^1.0",
88-
```
89-
90-
2. Remove your `config/geocoder.php` configuration file. (If you need to customize it, follow the configuration instructions below.)
91-
3. Remove any Geocoder alias in the aliases section of your `config/app.php`. (This package auto-registers the aliases.)
92-
4. Update the service provider entry in your `config/app.php` to read:
93-
94-
```php
95-
Geocoder\Laravel\Providers\GeocoderService::class,
96-
```
97-
98-
5. If you are using the facade in your code, you have two options:
99-
1. Replace the facades `Geocoder::` (and remove the corresponding `use` statements) with `app('geocoder')->`.
100-
2. Update the `use` statements to the following:
101-
102-
```php
103-
use Geocoder\Laravel\Facades\Geocoder;
104-
```
105-
106-
6. Update your query statements to use `->get()` (to retrieve a collection of
107-
GeoCoder objects) or `->all()` (to retrieve an array of arrays), then iterate
108-
to process each result.
109-
11047
## Configuration
11148
Pay special attention to the language and region values if you are using them.
11249
For example, the GoogleMaps provider uses TLDs for region values, and the
@@ -119,8 +56,7 @@ Further, a special note on the GoogleMaps provider: if you are using an API key,
11956
See the [Geocoder documentation](http://geocoder-php.org/Geocoder/) for a list
12057
of available adapters and providers.
12158

122-
### Configuration
123-
#### Providers
59+
### Providers
12460
If you are upgrading and have previously published the geocoder config file, you
12561
need to add the `cache-duration` variable, otherwise cache will be disabled
12662
(it will default to a `0` cache duration). The default cache duration provided
@@ -165,7 +101,7 @@ return [
165101
];
166102
```
167103

168-
#### Adapters
104+
### Adapters
169105
By default we provide a CURL adapter to get you running out of the box.
170106
However, if you have already installed Guzzle or any other PSR-7-compatible
171107
HTTP adapter, you are encouraged to replace the CURL adapter with it. Please
@@ -204,12 +140,85 @@ app('geocoder')->reverse(43.882587,-103.454067)->get();
204140
app('geocoder')->geocode('Los Angeles, CA')->dump('kml');
205141
```
206142

207-
## Changelog
208-
https://github.com/geocoder-php/GeocoderLaravel/blob/master/CHANGELOG.md
143+
## Upgrading
144+
Anytime you upgrade this package, please remember to clear your cache, to prevent incompatible cached responses when breaking changes are introduced (this should hopefully only be necessary in major versions):
145+
```sh
146+
php artisan cache:clear
147+
```
209148

210-
## Support
211-
If you are experiencing difficulties, please please open an issue on GitHub:
149+
### 1.x to 4.x
150+
Update your composer.json file:
151+
```json
152+
"toin0u/geocoder-laravel": "^4.0",
153+
```
154+
155+
The one change to keep in mind here is that the results returned from
156+
`Geocoder for Laravel` are now using the Laravel-native Collections class
157+
instead of returning an instance of `AddressCollection`. This should provide
158+
greater versatility in manipulation of the results, and be inline with
159+
expectations for working with Laravel. The existing `AddressCollection`
160+
methods should map strait over to Laravel's `Collection` methods. But be sure
161+
to double-check your results, if you have been using `count()`,
162+
`first()`, `isEmpty()`, `slice()`, `has()`, `get()`, or `all()` on your results.
163+
164+
Also, `getProviders()` now returns a Laravel Collection instead of an array.
165+
166+
**Alert:** if you have been using the `getIterator()` method, it is no longer
167+
needed. Simply iterate over your results as you would any other Laravel
168+
collection.
169+
170+
**Deprecated:**
171+
- the `all()` method on the geocoder is being deprecated in favor of using
172+
`get()`, which will return a Laravel Collection. You can then run `all()`
173+
on that. This method will be removed in version 5.0.0.
174+
- the `getProvider()` method on the geocoder is being deprecated in favor of using
175+
`getProviders()`, which will return a Laravel Collection. You can then run `first()`
176+
on that to get the same result. This method will be removed in version 5.0.0.
177+
178+
**Added:** this version introduces a new way to create more complex queries:
179+
- geocodeQuery()
180+
- reverseQuery()
181+
182+
Please see the [Geocoder documentation](https://github.com/geocoder-php/Geocoder)
183+
for more details.
184+
185+
### 0.x to 1.x
186+
If you are upgrading from a pre-1.x version of this package, please keep the
187+
following things in mind:
188+
189+
1. Update your composer.json file as follows:
190+
191+
```json
192+
"toin0u/geocoder-laravel": "^1.0",
193+
```
194+
195+
2. Remove your `config/geocoder.php` configuration file. (If you need to customize it, follow the configuration instructions below.)
196+
3. Remove any Geocoder alias in the aliases section of your `config/app.php`. (This package auto-registers the aliases.)
197+
4. Update the service provider entry in your `config/app.php` to read:
198+
199+
```php
200+
Geocoder\Laravel\Providers\GeocoderService::class,
201+
```
202+
203+
5. If you are using the facade in your code, you have two options:
204+
1. Replace the facades `Geocoder::` (and remove the corresponding `use` statements) with `app('geocoder')->`.
205+
2. Update the `use` statements to the following:
206+
207+
```php
208+
use Geocoder\Laravel\Facades\Geocoder;
209+
```
210+
211+
6. Update your query statements to use `->get()` (to retrieve a collection of
212+
GeoCoder objects) or `->all()` (to retrieve an array of arrays), then iterate
213+
to process each result.
214+
215+
## Troubleshooting
216+
- Clear cache: `php artisan cache:clear`.
217+
- If you are still experiencing difficulties, please please open an issue on GitHub:
212218
https://github.com/geocoder-php/GeocoderLaravel/issues.
219+
220+
## Changelog
221+
https://github.com/geocoder-php/GeocoderLaravel/blob/master/CHANGELOG.md
213222

214223
## Contributor Code of Conduct
215224
Please note that this project is released with a

0 commit comments

Comments
 (0)