Skip to content

Commit 50503d4

Browse files
committed
Improve docs
1 parent 7e2dfa1 commit 50503d4

File tree

3 files changed

+46
-43
lines changed

3 files changed

+46
-43
lines changed

README.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ To find out more simple open the `config/geoip.php` file.
4343

4444
### Service Configuration
4545

46-
To simplify and keep things clean, all third party composer packages, that are needed for a service, are installed separately.
46+
To simplify and keep things clean, all third party composer packages, which are needed for a service, are installed separately.
4747

48-
For further configuration options checkout the services page.
48+
For further configuration options, checkout the [services page](./docs/services.md).
4949

5050

5151
### Caching Configuration
@@ -54,9 +54,9 @@ GeoIP uses Laravel’s default caching to store queried IP locations.
5454
This is done to reduce the number of calls made to the selected service, as some of them are rate limited.
5555

5656
Options:
57-
- `all` all location are cached
57+
- `all` all locations are cached
5858
- `some` cache only the requesting user
59-
- `none` caching is completely disable
59+
- `none` caching is completely disabled
6060

6161

6262
## Usage
@@ -70,36 +70,37 @@ geoip()->getLocation('27.974.399.65'); // Get the location from the provided IP.
7070
geoip()->getClientIP(); // Will return the user IP address.
7171
```
7272

73-
Example of Location object:
73+
Example of a `Location` object:
7474
```php
75-
\InteractionDesignFoundation\GeoIP\Location {
76-
[
77-
'ip' => '1.1.1.1',
78-
'iso_code' => 'US',
79-
'country' => 'United States',
80-
'city' => 'New Haven',
81-
'state' => 'CT',
82-
'state_name' => 'Connecticut',
83-
'postal_code' => '06510',
84-
'lat' => 41.28,
85-
'lon' => -72.88,
86-
'timezone' => 'America/New_York',
87-
'continent' => 'NA',
88-
'currency' => 'USD',
89-
'default' => false,
90-
]
91-
}
75+
\InteractionDesignFoundation\GeoIP\Location {[
76+
'ip' => '1.1.1.1',
77+
'iso_code' => 'US',
78+
'country' => 'United States',
79+
'city' => 'New Haven',
80+
'state' => 'CT',
81+
'state_name' => 'Connecticut',
82+
'postal_code' => '06510',
83+
'lat' => 41.28,
84+
'lon' => -72.88,
85+
'timezone' => 'America/New_York',
86+
'continent' => 'NA',
87+
'currency' => 'USD',
88+
'default' => false,
89+
]}
9290
```
9391

94-
`Location` class implements `\ArrayAccess` interface, means you can access properties of the `Location` object using array access syntax:
92+
`Location` class implements `\ArrayAccess` interface, means you can access properties of the `Location` object using both object and array access:
9593
```php
9694
$location = geoip()->getLocation();
95+
96+
$city = $location->city;
97+
// The same as:
9798
$city = $location['city'];
9899
```
99100

100101
### Artisan
101102

102-
Some services require downloading and use local database to detect Location by IP address.
103+
Some services require downloading and use a local database to detect Location by IP address.
103104
There is a console command to download/update database:
104105
```sh
105106
php artisan geoip:update

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
- [Artisan](artisan.md)
55
- [Config](config.md)
66
- [Services](services.md)
7+
- [Migration from torann package](migration.md)

docs/usage.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,30 @@ geoip()->getLocation('27.974.399.65'); // Get the location from the provided IP.
99
geoip()->getClientIP(); // Will return the user IP address.
1010
```
1111

12-
Example of Location object:
12+
Example of a Location object:
1313
```php
14-
\InteractionDesignFoundation\GeoIP\Location {
15-
[
16-
'ip' => '1.1.1.1',
17-
'iso_code' => 'US',
18-
'country' => 'United States',
19-
'city' => 'New Haven',
20-
'state' => 'CT',
21-
'state_name' => 'Connecticut',
22-
'postal_code' => '06510',
23-
'lat' => 41.28,
24-
'lon' => -72.88,
25-
'timezone' => 'America/New_York',
26-
'continent' => 'NA',
27-
'currency' => 'USD',
28-
'default' => false,
29-
]
30-
}
14+
\InteractionDesignFoundation\GeoIP\Location {[
15+
'ip' => '1.1.1.1',
16+
'iso_code' => 'US',
17+
'country' => 'United States',
18+
'city' => 'New Haven',
19+
'state' => 'CT',
20+
'state_name' => 'Connecticut',
21+
'postal_code' => '06510',
22+
'lat' => 41.28,
23+
'lon' => -72.88,
24+
'timezone' => 'America/New_York',
25+
'continent' => 'NA',
26+
'currency' => 'USD',
27+
'default' => false,
28+
]}
3129
```
3230

33-
`Location` class implements `\ArrayAccess` interface, means you can access properties of the `Location` object using array access syntax:
31+
`Location` class implements `\ArrayAccess` interface, means you can access properties of the `Location` object using both object and array access:
3432
```php
3533
$location = geoip()->getLocation();
34+
35+
$city = $location->city;
36+
// The same as:
3637
$city = $location['city'];
3738
```

0 commit comments

Comments
 (0)