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
By default the result will be cached, to get realtime data you can pass a boolean value as the second parameter:
@@ -50,6 +63,47 @@ Get visitor's anonymized IP address:
50
63
// 2001:4860:4860:0:0:0:0:8888 = 2001:4860:4860::
51
64
$anonymizedIp = $request->anonymizedIp();
52
65
```
66
+
67
+
## Drivers
68
+
69
+
Laravel GeoIP support multiple drivers. By default, `geojs` driver will be used if you don't specify the driver when using the facade or when calling `geoip()` method via Laravel request instance.
70
+
71
+
You can change the default driver in your `.env` file as:
72
+
73
+
```
74
+
GEOIP_DEFAULT_DRIVER=geojs
75
+
```
76
+
77
+
Here are the drivers currently available for use.
78
+
79
+
### [GeoJS](https://www.geojs.io)
80
+
81
+
This is a completly free service, you don't have to do anything to get it to work. Simply pass `geojs` to the driver paremeter.
82
+
83
+
```php
84
+
use Reefki\Geoip\Geoip;
85
+
86
+
Geoip::driver('geojs')->get('8.8.8.8');
87
+
```
88
+
89
+
### [IPData](https://ipdata.co)
90
+
91
+
To use this driver, [register](https://dashboard.ipdata.co/sign-up.html) an account and put the API key in your `.env` file as:
92
+
93
+
```
94
+
IPDATA_API_KEY=YOUR_API_KEY
95
+
```
96
+
97
+
To get the IP information using this driver you can pass `ip-data` to the driver parameter:
98
+
99
+
```php
100
+
use Reefki\Geoip\Geoip;
101
+
102
+
Geoip::driver('ip-data')->get('8.8.8.8');
103
+
```
104
+
105
+
> Please note: IPData offers 1500 daily free requests. If your daily usage is more than 1500 you need to upgrade to one of their paid plan.
0 commit comments