Skip to content

Commit 133ec10

Browse files
authored
Merge pull request geocoder-php#324 from Chris53897/feature/improve-docs-new
docs: improve docs
2 parents cb37386 + ba5634d commit 133ec10

File tree

5 files changed

+136
-133
lines changed

5 files changed

+136
-133
lines changed

Resources/doc/cache.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ request will be both quicker and free of charge. To get started with caching you
77
by default in our configuration.
88

99
```yaml
10-
# config.yml
10+
# config/packages/bazinga_geocoder.yaml
1111
bazinga_geocoder:
12-
providers:
13-
acme:
14-
factory: Bazinga\GeocoderBundle\ProviderFactory\GoogleMapsFactory
15-
cache: 'any.psr16.service'
16-
cache_lifetime: 3600
17-
cache_precision: ~
12+
providers:
13+
acme:
14+
factory: Bazinga\GeocoderBundle\ProviderFactory\GoogleMapsFactory
15+
cache: 'any.psr16.service'
16+
cache_lifetime: 3600
17+
cache_precision: ~
1818
```
1919
2020
If you do a lot of reverse queries it can be useful to cache them with less precision. So if you are interested in only the city,
@@ -35,19 +35,19 @@ composer require geocoder-php/cache-provider
3535
```
3636

3737
```yaml
38-
# config.yml
38+
# config/packages/bazinga_geocoder.yaml
3939
bazinga_geocoder:
40-
providers:
41-
acme:
42-
factory: Bazinga\GeocoderBundle\ProviderFactory\GoogleMapsFactory
40+
providers:
41+
acme:
42+
factory: Bazinga\GeocoderBundle\ProviderFactory\GoogleMapsFactory
4343
```
4444

4545
```yaml
46-
# services.yml
47-
servies:
48-
my_cached_geocoder:
49-
class: Geocoder\Provider\Cache\ProviderCache
50-
arguments: ['@bazinga_geocoder.provider.acme', '@any.psr16.service', 3600]
46+
# config/services.yaml
47+
services:
48+
my_cached_geocoder:
49+
class: Geocoder\Provider\Cache\ProviderCache
50+
arguments: ['@bazinga_geocoder.provider.acme', '@any.psr16.service', 3600]
5151
```
5252

5353
## Installing a PSR16 cache
@@ -60,7 +60,7 @@ Symfony>=3.3 supports SimpleCache thanks to `Symfony\Component\Cache\Simple\Psr6
6060
Thus a service can be registered like so:
6161

6262
```yaml
63-
# services.yml
63+
# config/services.yaml
6464
app.simple_cache:
6565
class: Symfony\Component\Cache\Simple\Psr6Cache
6666
arguments: ['@app.cache.acme']
@@ -69,7 +69,7 @@ app.simple_cache:
6969
Then configure the framework and the bundle:
7070

7171
```yaml
72-
# config.yml
72+
# config/packages/cache.yaml
7373
framework:
7474
cache:
7575
app: cache.adapter.redis
@@ -78,13 +78,14 @@ framework:
7878
adapter: cache.app
7979
default_lifetime: 600
8080
81+
# config/packages/bazinga_geocoder.yaml
8182
bazinga_geocoder:
82-
providers:
83-
my_google_maps:
84-
factory: Bazinga\GeocoderBundle\ProviderFactory\GoogleMapsFactory
85-
cache: 'app.simple_cache'
86-
cache_lifetime: 3600
87-
cache_precision: 4
83+
providers:
84+
my_google_maps:
85+
factory: Bazinga\GeocoderBundle\ProviderFactory\GoogleMapsFactory
86+
cache: 'app.simple_cache'
87+
cache_lifetime: 3600
88+
cache_precision: 4
8889
```
8990

9091
For older Symfony version, you can use a bridge between PSR-6 and PSR-16. Install the

Resources/doc/custom-provider.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ If you want to use your own provider in your application, create a service, and
1212
```
1313

1414
The bundle will automatically register your provider into the`Geocoder\ProviderAggregator` service. However, it will not
15-
show up the the web profiler because it is not registered with the [PluginProvider](/Resources/doc/plugins.md).
15+
show up the web profiler because it is not registered with the [PluginProvider](/Resources/doc/plugins.md).
1616

1717
If you want your provider to show up the web profiler you have to create a custom factory for your provider.
1818

@@ -27,7 +27,8 @@ final class MyFactory extends AbstractFactory
2727
{
2828
private $fooService;
2929

30-
public function __construct(Foo $service) {
30+
public function __construct(Foo $service)
31+
{
3132
$this->someService = $service;
3233
}
3334

@@ -39,9 +40,10 @@ final class MyFactory extends AbstractFactory
3940
```
4041

4142
```yaml
43+
# config/packages/bazinga_geocoder.yaml
4244
bazinga_geocoder:
43-
providers:
44-
acme:
45-
factory: Acme\Demo\Geocoder\Factory\MyFactory
46-
aliases: ['acme_demo.geocoder.my_provider']
45+
providers:
46+
acme:
47+
factory: Acme\Demo\Geocoder\Factory\MyFactory
48+
aliases: ['acme_demo.geocoder.my_provider']
4749
```

Resources/doc/doctrine.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class User
5454
* @Geocoder\Longitude
5555
*/
5656
private $longitude;
57-
57+
5858
/**
5959
* @Geocoder\Address
6060
*/
@@ -65,7 +65,7 @@ class User
6565
}
6666
```
6767

68-
Secondly, register the Doctrine event listener and its dependencies in your `services.yaml` file.
68+
Secondly, register the Doctrine event listener and its dependencies in your `config/services.yaml` file.
6969
You have to indicate which provider to use to reverse geocode the address. Here we use `acme` provider we declared in bazinga_geocoder configuration earlier.
7070

7171
```yaml
@@ -83,7 +83,7 @@ You have to indicate which provider to use to reverse geocode the address. Here
8383
- doctrine.event_subscriber
8484
```
8585
86-
It is done!
86+
It is done!
8787
Now you can use it:
8888
8989
```php

0 commit comments

Comments
 (0)