Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No GeoIP service is configured. #99

Open
tristan-thar opened this issue Aug 12, 2024 · 4 comments
Open

No GeoIP service is configured. #99

tristan-thar opened this issue Aug 12, 2024 · 4 comments

Comments

@tristan-thar
Copy link

Hi! I am getting this exception when logging in to my app. After refreshing however, it disappears. Seems to be an issue with the IP detection? Any ideas how to fix it?

@learnedself
Copy link

I just started getting this issue

@ivanj26
Copy link

ivanj26 commented Nov 17, 2024

Hi! I am getting this exception when logging in to my app. After refreshing however, it disappears. Seems to be an issue with the IP detection? Any ideas how to fix it?

how do you solve it?

@mprince2k18
Copy link

any solution?

@ccc-developer
Copy link

Here are the steps I used to fix the "No GeoIP service is configured" error when using the torann/geoip package in Laravel applications.

  1. Publish the configuration:
php artisan vendor:publish --provider="Torann\GeoIP\GeoIPServiceProvider" --tag=config
  1. Choose and configure a GeoIP service in config/geoip.php (I picked ipdata):

The package comes with five pre-configured services. You can choose any of them based on your needs:

return [
    // Step 1: Choose your preferred service
    'service' => 'ipdata', // Change this to any of: maxmind_database, maxmind_api, ipgeolocation, ipdata, or ipfinder

    // Step 2: Configure the services section. Below are all available options:
    'services' => [
        'maxmind_database' => [
            'class' => \Torann\GeoIP\Services\MaxMindDatabase::class,
            'database_path' => storage_path('app/geoip.mmdb'),
            'update_url' => sprintf('https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=%s&suffix=tar.gz', env('MAXMIND_LICENSE_KEY')),
            'locales' => ['en'],
        ],
        'maxmind_api' => [
            'class' => \Torann\GeoIP\Services\MaxMindWebService::class,
            'user_id' => env('MAXMIND_USER_ID'),
            'license_key' => env('MAXMIND_LICENSE_KEY'),
            'locales' => ['en'],
        ],
        'ipgeolocation' => [
            'class' => \Torann\GeoIP\Services\IPGeoLocation::class,
            'secure' => true,
            'key' => env('IPGEOLOCATION_KEY'),
            'continent_path' => storage_path('app/continents.json'),
            'lang' => 'en',
        ],
        'ipdata' => [
            'class' => \Torann\GeoIP\Services\IPData::class,
            'key' => env('IPDATA_API_KEY'),
            'secure' => true,
        ],
        'ipfinder' => [
            'class' => \Torann\GeoIP\Services\IPFinder::class,
            'key' => env('IPFINDER_API_KEY'),
            'secure' => true,
            'locales' => ['en'],
        ],
    ],
];

Each service has its own requirements and features:

  • maxmind_database: Free, requires downloading a local database
  • maxmind_api: Paid service with high accuracy
  • ipgeolocation: Good free tier with paid options
  • ipdata: Modern API with generous free tier
  • ipfinder: Offers both free and paid tiers
  1. Add to .env:
IPDATA_API_KEY=your_ipdata_api_key_here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants