Skip to content

Commit d6e96f8

Browse files
BallisticPainNyholm
authored andcommitted
Added clarification on the public services link. Added a Usage link for chaining providers. Added the chaining providers section in Usage and Configuration. (#164)
1 parent 721d0a5 commit d6e96f8

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

Resources/doc/index.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Integration of the [**Geocoder**](http://github.com/geocoder-php/Geocoder) libra
66
Our documentation has the following sections:
77

88
* [Index](index.md) (This page)
9-
* [Public services](services.md)
9+
* [Public services](services.md) (Providers)
1010
* [Registering Your Own Provider](custom-provider.md)
1111
* [All about Cache](cache.md)
1212
* [Plugins](plugins.md)
@@ -17,6 +17,7 @@ Table of contents
1717

1818
* [Installation](#installation)
1919
* [Usage](#usage)
20+
* [Chain providers](#chain-providers)
2021
* [Fake local ip](#fake-local-ip)
2122
* [Cache](#cache-results)
2223
* [Dumpers](#dumper)
@@ -97,6 +98,36 @@ bazinga_geocoder:
9798
api_key: 'xxyy'
9899
```
99100

101+
### Chain providers
102+
103+
Someone was thinking ahead here. Wouldn't it be nice if you could pass your request through different `ProviderFactories`? You can!! With the `ChainFactory`, see the configuration below.
104+
105+
```yaml
106+
bazinga_geocoder:
107+
providers:
108+
acme:
109+
aliases:
110+
- my_geocoder
111+
cache: 'any.psr16.service'
112+
cache_lifetime: 3600
113+
factory: Bazinga\GeocoderBundle\ProviderFactory\GoogleMapsFactory
114+
options:
115+
api_key: 'xxxx'
116+
acme_ii:
117+
aliases:
118+
- my_geocoder_ii
119+
factory: Bazinga\GeocoderBundle\ProviderFactory\TomTomFactory
120+
options:
121+
api_key: 'xxyy'
122+
httplug_client: 'httplug.client' # When using HTTPlugBundle
123+
region: 'Sweden'
124+
chain:
125+
factory: Bazinga\GeocoderBundle\ProviderFactory\ChainFactory
126+
services: ['@bazinga_geocoder.providers.acme', '@bazinga_geocoder.providers.acme_ii']
127+
```
128+
129+
The `services` key could also be as follows `services: ['@my_geocoder', '@my_geocoder_ii']`. Notice these are the values from the `aliases` key.
130+
100131
### Fake local ip
101132

102133
You can fake your local IP through this bundle in order to get location
@@ -244,6 +275,13 @@ bazinga_geocoder:
244275
options:
245276
foo: bar
246277
biz: baz
278+
# ...
279+
free_chain:
280+
aliases:
281+
- free_geo_chain
282+
factory: Bazinga\GeocoderBundle\ProviderFactory\ChainFactory
283+
options:
284+
services: ['@acme', '@acme_ii']
247285
```
248286

249287
Backwards compatibility

0 commit comments

Comments
 (0)