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
To use the ip-api pro service you can set the options in your config.
67
73
@@ -78,7 +84,22 @@ $config = [
78
84
];
79
85
```
80
86
81
-
### Maxmind
87
+
#### Telize
88
+
89
+
To use the telize as the driver set the config, can also use https instead by setting `secure` to `true`.
90
+
91
+
Secure Example:
92
+
```php
93
+
$config = [
94
+
'driver' => 'telize',
95
+
'telize' => [
96
+
// optionally set secure (https) connection (default: false)
97
+
'secure' => true
98
+
],
99
+
];
100
+
```
101
+
102
+
#### Maxmind
82
103
83
104
Maxmind support the database type and also web api type.
84
105
@@ -107,19 +128,19 @@ $config = [
107
128
108
129
To use this package in Laravel, simply update the config file in `config/packages/pulkitjalan/geoip/config.php` to get the same effect.
109
130
110
-
### Methods
111
-
112
-
Here are the avaliable methods to pull out the required information.
131
+
### Available Methods
113
132
114
-
Set IP (Optional)
133
+
GeoIP will try to determin the ip using the following http headers: `HTTP_CLIENT_IP`, `HTTP_X_FORWARDED_FOR`, `HTTP_X_FORWARDED`, `HTTP_FORWARDED_FOR`, `HTTP_FORWARDED`, `REMOTE_ADDR` in this order. Optionally use the `setIp` method to set it.
115
134
116
135
```php
117
-
$geoip->setIP('127.0.0.1');
136
+
$geoip->setIp('127.0.0.1');
118
137
119
138
// Laravel
120
-
GeoIP::setIP('127.0.0.1');
139
+
GeoIP::setIp('127.0.0.1');
121
140
```
122
141
142
+
There are a number of available methods to pull out the required information. All methods will return an empty string if data is unavailable.
143
+
123
144
Get latitude
124
145
125
146
```php
@@ -134,7 +155,7 @@ Get longitude
134
155
```php
135
156
$geoip->getLongitude();
136
157
137
-
//Laravel
158
+
//Laravel
138
159
GeoIP::getLongitude();
139
160
```
140
161
@@ -143,7 +164,7 @@ Get city
143
164
```php
144
165
$geoip->getCity();
145
166
146
-
//Laravel
167
+
//Laravel
147
168
GeoIP::getCity();
148
169
```
149
170
@@ -152,7 +173,7 @@ Get country
152
173
```php
153
174
$geoip->getCountry();
154
175
155
-
//Laravel
176
+
//Laravel
156
177
GeoIP::getCountry();
157
178
```
158
179
@@ -161,7 +182,7 @@ Get country code
161
182
```php
162
183
$geoip->getCountryCode();
163
184
164
-
//Laravel
185
+
//Laravel
165
186
GeoIP::getCountryCode();
166
187
```
167
188
@@ -170,7 +191,7 @@ Get region
170
191
```php
171
192
$geoip->getRegion();
172
193
173
-
//Laravel
194
+
//Laravel
174
195
GeoIP::getRegion();
175
196
```
176
197
@@ -179,7 +200,7 @@ Get region code
179
200
```php
180
201
$geoip->getRegionCode();
181
202
182
-
//Laravel
203
+
//Laravel
183
204
GeoIP::getRegionCode();
184
205
```
185
206
@@ -188,7 +209,7 @@ Get postal code
188
209
```php
189
210
$geoip->getPostalCode();
190
211
191
-
//Laravel
212
+
//Laravel
192
213
GeoIP::getPostalCode();
193
214
```
194
215
@@ -197,22 +218,31 @@ Get timezone
197
218
```php
198
219
$geoip->getTimezone();
199
220
200
-
//Laravel
221
+
//Laravel
201
222
GeoIP::getTimezone();
202
223
```
203
224
225
+
Get isp (not supported on all drivers)
226
+
227
+
```php
228
+
$geoip->getIsp();
229
+
230
+
// Laravel
231
+
GeoIP::getIsp();
232
+
```
233
+
204
234
Get all geo information
205
235
206
236
```php
207
237
$geoip->get(); // returns array
208
238
209
-
//Laravel
239
+
//Laravel
210
240
GeoIP::get(); // returns array
211
241
```
212
242
213
243
### Update Database
214
244
215
-
There is an update command avaliable to help with updating and installing a local geoip database. The following will download and install/update the database file to `/path/to/database.mmdb`.
245
+
There is an update command available to help with updating and installing a local geoip database. The following will download and install/update the database file to `/path/to/database.mmdb`.
216
246
217
247
```php
218
248
<?php
@@ -236,10 +266,14 @@ Once you have registered the service provider, you can use the command `php arta
236
266
237
267
## Services
238
268
239
-
### IP-API
269
+
####IP-API
240
270
241
271
IP-API is a free (or paid) service that can also be used instead of the database file or the paid maxmind service. They do have some limitations on the free service so please have a look at the [docs](http://ip-api.com/docs/) first.
242
272
243
-
### Maxmind
273
+
#### Telize
274
+
275
+
Telize is a free service that can be used as an alternative. It currently has no limitations.
276
+
277
+
#### Maxmind
244
278
245
279
You can use the free database from maxmind or their web api service. You can download the free database service [here](http://dev.maxmind.com/geoip/geoip2/geolite2/) or enter your `user id` and `license key` in the config.
0 commit comments