You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can install this library by running the following command:
23
19
24
-
composer require dotkernel/dot-geoip
20
+
```shell
21
+
composer require dotkernel/dot-geoip
22
+
```
25
23
26
24
If your application didn't already use it, the above command also installed [dotkernel/dot-cli](https://github.com/dotkernel/dot-cli).
27
25
In this case, see it's [README](https://github.com/dotkernel/dot-cli/blob/3.0/README.md) file on how to use it.
@@ -30,86 +28,98 @@ Copy config file `vendor/dotkernel/dot-geoip/config/autoload/geoip.global.php` i
30
28
31
29
Register the library's ConfigProvider by adding the following line to your application's `config/config.php` file:
32
30
33
-
Dot\GeoIP\ConfigProvider::class,
31
+
```php
32
+
Dot\GeoIP\ConfigProvider::class,
33
+
```
34
34
35
35
Register the library's synchronizer command by adding the following line to your application's `config/autoload/cli.global.php` file under the `commands` array key:
You can download/update a specific GeoLite2 database, by running the following command:
42
44
43
-
php bin/cli.php geoip:synchronize -d {DATABASE}
45
+
```shell
46
+
php ./bin/cli.php geoip:synchronize -d {DATABASE}
47
+
```
44
48
45
49
Where _{DATABASE}_ takes one of the following values: `asn`, `city`, `country`.
46
50
47
51
You can download/update all GeoLite2 databases at once, by running the following command:
48
52
49
-
php bin/cli.php geoip:synchronize
53
+
```shell
54
+
php ./bin/cli.php geoip:synchronize
55
+
```
50
56
51
57
The output should be similar to the below, displaying per row: `database identifier`: `previous build datetime` -> `current build datetime`.
52
58
53
-
asn: n/a -> 2021-07-01 02:09:34
54
-
city: n/a -> 2021-07-01 02:09:20
55
-
country: n/a -> 2021-07-01 02:05:12
59
+
```text
60
+
asn: n/a -> 2021-07-01 02:09:34
61
+
city: n/a -> 2021-07-01 02:09:20
62
+
country: n/a -> 2021-07-01 02:05:12
63
+
```
56
64
57
-
Get help for this command by running `php bin/cli.php help geoip:synchronize`.
65
+
Get help for this command by running `php ./bin/cli.php help geoip:synchronize`.
58
66
59
-
**Tip**: If you setup the synchronizer command as a cronjob, you can add the `-q|--quiet` option, and it will output data only if an error has occurred.
67
+
>If you set up the synchronizer command as a cronjob, you can add the `-q|--quiet` option, and it will output data only if an error has occurred.
60
68
61
69
## Usage
62
70
63
71
Below is an example implementation of using DotGeoip to retrieve information about an IP address.
Copy file name to clipboardExpand all lines: composer.json
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "dotkernel/dot-geoip",
3
-
"description": "DotKernel component based on Maxmind's geoip2/geoip2 package, using their free GeoLite2 databases to provide geographical details about an IP address.",
3
+
"description": "Dotkernel component based on Maxmind's geoip2/geoip2 package, using their free GeoLite2 databases to provide geographical details about an IP address.",
Copy file name to clipboardExpand all lines: docs/book/v3/configuration.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,12 @@ Copy config file `vendor/dotkernel/dot-geoip/config/autoload/geoip.global.php` i
4
4
5
5
Register the library's ConfigProvider by adding the following line to your application's `config/config.php` file:
6
6
7
-
Dot\GeoIP\ConfigProvider::class,
7
+
```php
8
+
Dot\GeoIP\ConfigProvider::class,
9
+
```
8
10
9
11
Register the library's synchronizer command by adding the following line to your application's `config/autoload/cli.global.php` file under the `commands` array key:
Get help for this command by running `php bin/cli.php help geoip:synchronize`.
26
26
27
-
**Tip**: If you set up the synchronizer command as a cronjob, you can add the `-q|--quiet` option, and it will output data only if an error has occurred.
27
+
>If you set up the synchronizer command as a cronjob, you can add the `-q|--quiet` option, and it will output data only if an error has occurred.
0 commit comments