Skip to content

Commit a622b91

Browse files
committed
Move doc to Resources/doc/
Fix #42
1 parent 20caec9 commit a622b91

File tree

4 files changed

+274
-211
lines changed

4 files changed

+274
-211
lines changed

CONTRIBUTING.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Contributing
2+
============
3+
4+
First of all, **thank you** for contributing, **you are awesome**!
5+
6+
Here are a few rules to follow in order to ease code reviews, and discussions before
7+
maintainers accept and merge your work.
8+
9+
You MUST follow the [PSR-1](http://www.php-fig.org/psr/1/) and
10+
[PSR-2](http://www.php-fig.org/psr/2/). If you don't know about any of them, you
11+
should really read the recommendations. Can't wait? Use the [PHP-CS-Fixer
12+
tool](http://cs.sensiolabs.org/).
13+
14+
You MUST run the test suite.
15+
16+
You MUST write (or update) unit tests.
17+
18+
You SHOULD write documentation.
19+
20+
Please, write [commit messages that make
21+
sense](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
22+
and [rebase your branch](http://git-scm.com/book/en/Git-Branching-Rebasing)
23+
before submitting your Pull Request.
24+
25+
One may ask you to [squash your
26+
commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)
27+
too. This is used to "clean" your Pull Request before merging it (we don't want
28+
commits such as `fix tests`, `fix 2`, `fix 3`, etc.).
29+
30+
Thank you!

README.md

Lines changed: 15 additions & 210 deletions
Original file line numberDiff line numberDiff line change
@@ -8,230 +8,35 @@ Integration of the [**Geocoder**](http://github.com/willdurand/Geocoder) library
88
into Symfony2.
99

1010

11-
Installation
12-
------------
13-
14-
Using Composer, just add the following configuration to your `composer.json`:
15-
16-
```json
17-
{
18-
"require": {
19-
"willdurand/geocoder-bundle": "*"
20-
}
21-
}
22-
```
23-
24-
Register the bundle in `app/AppKernel.php`:
25-
26-
// app/AppKernel.php
27-
public function registerBundles()
28-
{
29-
return array(
30-
// ...
31-
new Bazinga\Bundle\GeocoderBundle\BazingaGeocoderBundle(),
32-
);
33-
}
11+
Documentation
12+
-------------
3413

14+
For documentation, see:
3515

36-
Usage
37-
-----
16+
Resources/doc/
3817

39-
This bundle registers a `bazinga_geocoder.geocoder` service which is an instance
40-
of `Geocoder`. You'll be able to do whatever you want with it.
41-
42-
**NOTE:** When using `Request::getClientIp()` with Symfony 2.1+, ensure you have a trusted proxy set in your
43-
`config.yml`:
44-
45-
``` yaml
46-
# app/config/config.yml
47-
framework:
48-
trusted_proxies: ['127.0.0.1']
49-
# ...
50-
```
18+
[Read the documentation](https://github.com/willdurand/BazingaGeocoderBundle/blob/master/Resources/doc/index.md)
5119

52-
#### Killer Feature ####
5320

54-
You can fake the `REMOTE_ADDR` HTTP parameter through this bundle in order to get
55-
information in your development environment, for instance:
56-
57-
``` php
58-
<?php
59-
60-
// ...
61-
62-
/**
63-
* @Template()
64-
*/
65-
public function indexAction()
66-
{
67-
// Retrieve information from the current user (by its IP address)
68-
$result = $this->geocoder
69-
->using('yahoo')
70-
->geocode($this->getRequest()->server->get('REMOTE_ADDR'));
71-
72-
// Find the 5 nearest objects from the current user.
73-
$objects = ObjectQuery::create()
74-
->filterByDistanceFrom($result->getLatitude(), $result->getLongitude(), 15)
75-
->limit(5)
76-
->find();
77-
78-
return array(
79-
'geocoded' => $result,
80-
'nearest_objects' => $objects
81-
);
82-
}
83-
```
21+
Contributing
22+
------------
8423

85-
In the example, we'll retrieve information from the user's IP address, and 5
86-
objects nears him.
87-
But it won't work on your local environment, that's why this bundle provides
88-
an easy way to fake this behavior by using a `fake_ip` parameter.
89-
90-
``` yaml
91-
# app/config/config_dev.yml
92-
bazinga_geocoder:
93-
fake_ip: 123.345.643.133
94-
```
95-
96-
If set, the parameter will replace the `REMOTE_ADDR` value by the given one.
97-
98-
## Dumpers ##
99-
100-
If you need to dump your geocoded data to a specific format, you can use the
101-
__Dumper__ component. The following dumper's are supported:
102-
103-
* Geojson
104-
* GPX
105-
* KMP
106-
* WKB
107-
* WKT
108-
109-
Here is an example:
110-
111-
```php
112-
<?php
113-
114-
public function geocodeAction()
115-
{
116-
$result = $this->container->get('bazinga_geocoder.geocoder')
117-
->geocode($this->container->get('request')->server->get('REMOTE_ADDR'));
118-
119-
$body = $this->container->get('bazinga_geocoder.dumper_manager')
120-
->get('geojson')
121-
->dump($result);
122-
123-
$response = new Response();
124-
$response->setContent($body);
125-
126-
return $response;
127-
}
128-
```
129-
130-
To register a new dumper, you must tag it with _geocoder.dumper_.
131-
Geocoder detect and register it automaticly.
132-
133-
A little example:
134-
135-
```xml
136-
<service id="some.dumper" class="%some.dumper.class">
137-
<tag name="geocoder.dumper" alias="custom" />
138-
</service>
139-
```
140-
Cache Provider
141-
---------------
142-
143-
Sometimes you have to cache the results from a provider. For this case the bundle provides
144-
a cache provider. The cache provider wraps another provider and delegate all calls
145-
to this provider and cache the return value.
146-
147-
__Configuration example:__
148-
149-
```yaml
150-
services:
151-
acme_cache_adapter:
152-
class: "Doctrine\Common\Cache\ApcCache"
153-
154-
bazinga_geocoder:
155-
providers:
156-
cache:
157-
adapter: acme_cache_adapter
158-
provider: google_maps
159-
google_maps: ~
160-
```
161-
162-
> Tip: If you want to configure the cache adapter,
163-
> we recommend the [liip/doctrine-cache-bundle](https://github.com/liip/LiipDoctrineCacheBundle.git).
164-
165-
166-
167-
Reference Configuration
168-
-----------------------
169-
170-
You have to define the providers you want to use in your configuration.
171-
Some of them need information (API key for instance).
172-
173-
You'll find the reference configuration below:
174-
175-
``` yaml
176-
# app/config/config*.yml
177-
178-
bazinga_geocoder:
179-
fake_ip: 999.999.999.999
180-
adapter:
181-
class: \Your\CustomAdapter
182-
providers:
183-
bing_maps:
184-
api_key: XXXXXXXXX
185-
locale: xx_XX
186-
google_maps:
187-
locale: xx_XX
188-
region: xx_XX
189-
ip_info_db:
190-
api_key: XXXXXXXXX
191-
yahoo:
192-
api_key: XXXXXXXXX
193-
locale: xx_XX
194-
cloudmade:
195-
api_key: XXXXXXXXX
196-
free_geo_ip: ~
197-
openstreetmaps:
198-
locale: xx_XX
199-
host_ip: ~
200-
geoip: ~
201-
mapquest: ~
202-
oiorest: ~
203-
geocoder_ca: ~
204-
geocoder_us: ~
205-
ign_openls:
206-
api_key: XXXXXXXXX
207-
data_science_toolkit: ~
208-
yandex:
209-
locale: xx-XX
210-
toponym: XXXXXXXXX
211-
geo_ips:
212-
api_key: XXXXXXXXX
213-
geo_plugin: ~
214-
maxmind:
215-
api_key: XXXXXXXXX
216-
# Caching Layer
217-
cache:
218-
provider: openstreetmaps
219-
adapter: some_service_id
220-
lifetime: 86400
221-
locale: %locale%
222-
chain:
223-
providers: [free_geo_ip, host_ip]
224-
```
24+
See
25+
[CONTRIBUTING](https://github.com/willdurand/BazingaGeocoderBundle/blob/master/CONTRIBUTING.md)
26+
file.
22527

22628

22729
Credits
22830
-------
22931

230-
* William Durand <[email protected]>
32+
* William Durand
23133
* [All contributors](https://github.com/willdurand/BazingaGeocoderBundle/contributors)
23234

23335

23436
License
23537
-------
23638

237-
See `Resources/meta/LICENSE`.
39+
This bundle is released under the MIT license. See the complete license in the
40+
bundle:
41+
42+
Resources/meta/LICENSE

0 commit comments

Comments
 (0)