chintanlin/laravel-geoip2

The provider of geoip2 for laravel

v1.0.0 2020-07-09 13:11 UTC

This package is auto-updated.

Last update: 2024-04-11 01:03:35 UTC


README

Build Status Latest Stable Version Total Downloads License

GeoIP2 for Laravel

composer require chintanlin/laravel-geoip2

How to use

    GeoIP2::getCountry('8.8.8.8');  // Facades
    app('geoip2')->getCountry('8.8.8.8'); // Providers
    geoip2('8.8.8.8'); // helpers
    
    // use maxmind/GeoIP2 PHP API directly
    $record = GeoIP2::city('8.8.8.8'); 
    $record->country->name;

Update Database

Database file store at storage_path('app/GeoLite2-City.mmdb')

ex : Laravel/storage/app/GeoLite2-City.mmdb

You should use your private license key in .env (MAXMIND_LICENSE=xxxx)

    php artisan geoip2:update;