Skip to content

Commit

Permalink
update readme and config
Browse files Browse the repository at this point in the history
  • Loading branch information
pulkitjalan committed Oct 13, 2024
1 parent ff14c53 commit 81edca5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ IP Geolocation
[![License](https://poser.pugx.org/pulkitjalan/ip-geolocation/license)](https://packagist.org/packages/pulkitjalan/ip-geolocation)


This package provides an easy way to get geolocation information from IP addresses. It supports multiple drivers including IP-API, MaxMind Database, MaxMind API, IPStack, and IP2Location.
This package provides an easy way to get geolocation information from IP addresses. It supports multiple drivers including IP-API, MaxMind Database, MaxMind API, IPStack, IP2Location, and IPinfo.

## Requirements

Expand Down Expand Up @@ -38,7 +38,11 @@ Next add the following to the `aliases` array in your `config/app.php`
'IPGeolocation' => PulkitJalan\IPGeolocation\Facades\IPGeolocation::class
```

Next run `php artisan vendor:publish --provider="PulkitJalan\IPGeolocation\IPGeolocationServiceProvider" --tag="config"` to publish the config file.
Next publish the config file:

```bash
php artisan vendor:publish --provider="PulkitJalan\IPGeolocation\IPGeolocationServiceProvider" --tag="config"
```

#### Using an older version of PHP / Laravel?

Expand Down Expand Up @@ -133,8 +137,19 @@ $config = [
];
```

#### IPinfo

Note: Make sure to download the appropriate IP2Location database file and provide the correct path in the configuration.
To use IPinfo as the driver, set the config as follows:

Example:
```php
$config = [
'driver' => 'ipinfo',
'ipinfo' => [
'token' => 'YOUR IPINFO API TOKEN',
],
];
```

### Laravel

Expand Down Expand Up @@ -303,6 +318,10 @@ IPStack is a real-time IP to geolocation API service. They offer both free and p

IP2Location provides IP geolocation databases and web services. They offer various products and services, including both free and paid options. You can learn more and sign up on their [website](https://www.ip2location.io/).

### IPinfo

IPinfo is a comprehensive IP address data provider offering accurate geolocation, ASN, company, and other IP-related information. They provide both API and database download options. You can sign up for a free API key or explore their paid plans on their [website](https://ipinfo.io/).

## License

The MIT License (MIT). Please see the [License File](LICENSE) for more information.
10 changes: 10 additions & 0 deletions config/ip-geolocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,14 @@
// Get your API key here: https://www.ip2location.io/pricing
'api_key' => env('IPGEOLOCATION_IP2LOCATION_API_KEY'),
],

/*
|--------------------------------------------------------------------------
| IPInfo Driver
|--------------------------------------------------------------------------
*/
'ipinfo' => [
// Get your token here: https://ipinfo.io/
'token' => env('IPGEOLOCATION_IPINFO_TOKEN'),
],
];

0 comments on commit 81edca5

Please sign in to comment.