Skip to content

Commit 31d1819

Browse files
committed
Update documentation, changelog, change namespace
1 parent 379682d commit 31d1819

File tree

10 files changed

+202
-198
lines changed

10 files changed

+202
-198
lines changed

CHANGELOG.md

Lines changed: 61 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,61 @@
1-
CHANGELOG
2-
=========
3-
4-
0.5.0 (2015-03-11)
5-
------------------
6-
7-
* [BC] the package is now compatible for Laravel 5
8-
* improved the doc
9-
* add code of conduct
10-
11-
0.4.1 (2014-06-23)
12-
------------------
13-
14-
* fix the way to implode provider's arguments + unit tests
15-
16-
0.4.0 (2014-04-13)
17-
------------------
18-
19-
* use Geocoder 2.4.*
20-
21-
22-
0.3.0 (2014-04-13)
23-
------------------
24-
25-
* support provider's arugments (BC break)
26-
27-
28-
0.2.0 (2013-11-16)
29-
------------------
30-
31-
* use Geocoder 2.3.x
32-
* use config file
33-
* use singleton instead of share
34-
* improve tests
35-
36-
37-
0.1.0 (2013-09-16)
38-
------------------
39-
40-
* add badges
41-
* initial import
1+
# Geocoder for Laravel Changelog
2+
All notable changes to this project will be documented in this file.
3+
This project adheres to [Semantic Versioning](http://semver.org/).
4+
5+
## [0.7.0] - 1 Oct 2016
6+
### Added
7+
- ability to dump results #16.
8+
- ability to use multiple providers in addition to the chain provider #47.
9+
- more integration tests.
10+
- special aggregator that allows chaining of `geocode()` and other methods.
11+
12+
### Changed
13+
- README documentation.
14+
- to use Geocoder 3.3.x.
15+
- namespace to `Geocoder\Laravel\...`.
16+
- service provider to auto-load the facade.
17+
- config file format.
18+
- geocoding commands necessary to obtain results (must use `->all()`, `->get()`,
19+
or `->dump()`) after the respective command.
20+
- the service provider architecture.
21+
22+
### Fixed
23+
- MaxMindBinary Provider being instantiated with an Adapter #24.
24+
- GeoIP2 Provider being instantiated with a generic Adapter.
25+
26+
## [0.6.0]
27+
- TBD
28+
29+
## [0.5.0] - 11 Mar 2015
30+
### Added
31+
- code of conduct message.
32+
- Laravel 5 compatibility [BC].
33+
34+
### Updated
35+
- documentation.
36+
37+
## [0.4.1] - 23 Jun 2014
38+
### Fixed
39+
- the way to implode provider's arguments + unit tests.
40+
41+
## [0.4.0] - 13 Apr 2014
42+
### Updated
43+
- to use Geocoder 2.4.x.
44+
45+
## [0.3.0] - 13 Apr 2014
46+
### Added
47+
- support for Provider arguments (backwards-compatibility break).
48+
49+
## [0.2.0] - 16 Nov 2013
50+
### Added
51+
- config file.
52+
53+
### Updated
54+
- to use Geocoder 2.3.x.
55+
- to use singleton instead of share.
56+
- tests.
57+
58+
## [0.1.0] - 16 Sep 2013
59+
### Added
60+
- badges.
61+
- initial package.

README.md

Lines changed: 96 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,145 +1,126 @@
1-
Geocoder for Lavarel 5
2-
======================
3-
4-
If you still use **Laravel 4**, please check out the `0.4.x` branch [here](https://github.com/geocoder-php/GeocoderLaravel/tree/0.4.x).
5-
6-
This package allows you to use [**Geocoder**](http://geocoder-php.org/Geocoder/)
7-
in [**Laravel 5**](http://laravel.com/).
8-
91
[![Latest StableVersion](https://poser.pugx.org/toin0u/geocoder-laravel/v/stable.png)](https://packagist.org/packages/toin0u/geocoder-laravel)
2+
use Toin0u\Geocoder\GeocoderServiceProvider;
103
[![Total Downloads](https://poser.pugx.org/toin0u/geocoder-laravel/downloads.png)](https://packagist.org/packages/toin0u/geocoder-laravel)
114
[![Build Status](https://secure.travis-ci.org/geocoder-php/GeocoderLaravel.png)](http://travis-ci.org/geocoder-php/GeocoderLaravel)
125
[![Coverage Status](https://coveralls.io/repos/geocoder-php/GeocoderLaravel/badge.png)](https://coveralls.io/r/geocoder-php/GeocoderLaravel)
136

7+
# Geocoder for Lavarel
148

15-
Installation
16-
------------
17-
18-
It can be found on [Packagist](https://packagist.org/packages/toin0u/geocoder-laravel).
19-
The recommended way is through [composer](http://getcomposer.org).
20-
21-
Edit `composer.json` and add:
9+
> If you still use **Laravel 4**, please check out the `0.4.x` branch
10+
[here](https://github.com/geocoder-php/GeocoderLaravel/tree/0.4.x).
2211

23-
```json
24-
{
25-
"require": {
26-
"toin0u/geocoder-laravel": "@stable"
27-
}
28-
}
29-
```
12+
** Version 0.7.0 is a backwards-compatibility-breaking update. Please review
13+
this documentation, especially the _Usage_ section before installing. **
3014

31-
**Protip:** you should browse the
32-
[`toin0u/geocoder-laravel`](https://packagist.org/packages/toin0u/geocoder-laravel)
33-
page to choose a stable version to use, avoid the `@stable` meta constraint.
15+
This package allows you to use [**Geocoder**](http://geocoder-php.org/Geocoder/)
16+
in [**Laravel 5**](http://laravel.com/).
17+
18+
## Installation
19+
1. Install the package via composer:
20+
```sh
21+
composer require toin0u/geocoder-laravel
22+
```
23+
24+
2. Find the `providers` array key in `config/app.php` and register the **Geocoder
25+
Service Provider**:
26+
```php
27+
// 'providers' => [
28+
Toin0u\GeocoderLaravel\Providers\GeocoderService::class,
29+
// ];
30+
```
3431

35-
And install dependencies:
36-
```bash
37-
$ composer update
32+
## Configuration
33+
Pay special attention to the language and region values if you are using them.
34+
For example, the GoogleMaps provider uses TLDs for region values, and the
35+
following for language values: https://developers.google.com/maps/faq#languagesupport.
36+
37+
Further, a special note on the GoogleMaps provider: if you are using an API key,
38+
you must also use set HTTPS to true. (Best is to leave it true always, unless
39+
there is a special requirement not to.)
40+
41+
See the [Geocoder documentation](http://geocoder-php.org/Geocoder/) for a list
42+
of available adapters and providers.
43+
44+
### Default Settings
45+
By default, the configuration specifies a Chain Provider as the first provider,
46+
containing GoogleMaps and FreeGeoIp providers. The first to return a result
47+
will be returned. After the Chain Provider, we have added the BingMaps provider
48+
for use in specific situations (providers contained in the Chain provider will
49+
be run by default, providers not in the Chain provider need to be called
50+
explicitly). The second GoogleMaps Provider outside of the Chain Provider is
51+
there just to illustrate this point (and is used by the PHPUnit tests).
52+
```php
53+
return [
54+
'providers' => [
55+
Chain::class => [
56+
GoogleMaps::class => [
57+
'en',
58+
'us',
59+
true,
60+
env('GOOGLE_MAPS_API_KEY'),
61+
],
62+
FreeGeoIp::class => [],
63+
],
64+
BingMaps::class => [
65+
'en-US',
66+
env('BING_MAPS_API_KEY'),
67+
],
68+
GoogleMaps::class => [
69+
'en',
70+
'us',
71+
true,
72+
env('GOOGLE_MAPS_API_KEY'),
73+
],
74+
],
75+
'adapter' => CurlHttpAdapter::class,
76+
];
3877
```
3978

40-
If you do not have [**Composer**](https://getcomposer.org) installed, run these two commands:
41-
42-
```bash
43-
$ curl -sS https://getcomposer.org/installer | php
44-
$ php composer.phar install
79+
### Customization
80+
If you would like to make changes to the default configuration, publish and
81+
edit the configuration file:
82+
```sh
83+
php artisan vendor:publish --provider="Toin0u\Geocoder\GeocoderServiceProvider" --tags="config"
4584
```
4685

86+
## Usage
87+
The service provider initializes the `geocoder` service, accessible via the
88+
facade `Geocoder::...` or the application helper `app('geocoder')->...`.
4789

48-
Usage
49-
-----
50-
51-
Find the `providers` array key in `config/app.php` and register the **Geocoder Service Provider**.
52-
90+
### Geocoding Addresses
91+
#### Get Collection of Addresses
5392
```php
54-
'providers' => array(
55-
// ...
56-
57-
Toin0u\Geocoder\GeocoderServiceProvider::class,
58-
)
93+
app('geocoder')->geocode('Los Angeles, CA')->get();
5994
```
6095

61-
Find the `aliases` array key in `config/app.php` and register the **Geocoder Facade**.
62-
96+
#### Get Array of Addresses
6397
```php
64-
'aliases' => array(
65-
// ...
66-
67-
'Geocoder' => Toin0u\Geocoder\Facade\Geocoder::class,
68-
)
98+
app('geocoder')->geocode('Los Angeles, CA')->all();
6999
```
70100

71-
## Configuration
72-
Publish and edit the configuration file
73-
74-
```sh
75-
php artisan vendor:publish --provider="Toin0u\Geocoder\GeocoderServiceProvider" --tags="config"
76-
```
77-
78-
The service provider creates the following services:
79-
80-
* `geocoder`: the Geocoder instance.
81-
* `geocoder.chain`: the chain provider used by Geocoder.
82-
* `geocoder.adapter`: the HTTP adapter used to get data from remotes APIs.
83-
84-
By default, the `geocoder.chain` service contains `GoogleMapsProvider` and `FreeGeoIpProvider`.
85-
The `geocoder.adapter` service uses the cURL adapter. Override these services to use the
86-
adapter/providers you want by editing `config/geocoder.php`:
87-
101+
#### Reverse-Geocoding
88102
```php
89-
return [
90-
'providers' => [
91-
'\Geocoder\Provider\GoogleMapsProvider' => ['en_EN', 'my-region', $ssl = false, 'MY_API_KEY'],
92-
'\Geocoder\Provider\GoogleMapsBusinessProvider' => ['my-locale', 'my-region', $ssl = true, 'MY_API_KEY'],
93-
],
94-
'adapter' => '\Geocoder\HttpAdapter\CurlHttpAdapter'
95-
];
103+
app('geocoder')->reverse('Los Angeles, CA')->all();
96104
```
97105

98-
NB: As you can see the array value of the provider is the constructor arguments.
99-
100-
See [the Geocoder documentation](http://geocoder-php.org/Geocoder/) for a list of available adapters and providers.
101-
102-
103-
Example with Facade
104-
-------------------
105-
106+
#### Dumping Results
106107
```php
107-
<?php
108-
109-
// ...
110-
try {
111-
$geocode = Geocoder::geocode('10 rue Gambetta, Paris, France');
112-
// The GoogleMapsProvider will return a result
113-
var_dump($geocode);
114-
} catch (\Exception $e) {
115-
// No exception will be thrown here
116-
echo $e->getMessage();
117-
}
108+
app('geocoder')->reverse('Los Angeles, CA')->dump('kml');
118109
```
119110

111+
## Changelog
112+
https://github.com/geocoder-php/GeocoderLaravel/blob/master/CHANGELOG.md
120113

121-
Changelog
122-
---------
123-
124-
[See the CHANGELOG file](https://github.com/geocoder-php/GeocoderLaravel/blob/master/CHANGELOG.md)
125-
126-
127-
Support
128-
-------
129-
130-
[Please open an issue on GitHub](https://github.com/geocoder-php/GeocoderLaravel/issues)
131-
132-
133-
Contributor Code of Conduct
134-
---------------------------
135-
136-
Please note that this project is released with a Contributor Code of Conduct.
137-
By participating in this project you agree to abide by its terms.
138-
114+
## Support
115+
If you are experiencing difficulties, please please open an issue on GitHub:
116+
https://github.com/geocoder-php/GeocoderLaravel/issues.
139117

140-
License
141-
-------
118+
## Contributor Code of Conduct
119+
Please note that this project is released with a
120+
[Contributor Code of Conduct](https://github.com/geocoder-php/Geocoder#contributor-code-of-conduct).
121+
By participating in this project you agree to abide by its terms.
142122

123+
## License
143124
GeocoderLaravel is released under the MIT License. See the bundled
144-
[LICENSE](https://github.com/geocoder-php/GeocoderLaravel/blob/master/LICENSE)
145-
file for details.
125+
[LICENSE](https://github.com/geocoder-php/GeocoderLaravel/blob/master/LICENSE)
126+
file for details.

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
},
3535
"autoload": {
3636
"psr-4": {
37-
"Toin0u\\Geocoder\\": "src/"
37+
"Geocoder\\Laravel\\": "src/",
38+
"Geocoder\\Laravel\\Tests\\": "tests/"
3839
}
3940
},
4041
"autoload-dev": {
4142
"psr-4": {
42-
"Toin0u\\Tests\\Geocoder\\": "tests/Geocoder/",
43-
"Toin0u\\GeocoderLaravel\\Tests\\Laravel5_3\\": "tests/Laravel5_3/"
43+
"Geocoder\\Laravel\\Tests\\": "tests/"
4444
}
4545
},
4646
"extra": {

0 commit comments

Comments
 (0)