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

geo:info returns no data #13

Open
joelprestaworks opened this issue Dec 30, 2020 · 2 comments
Open

geo:info returns no data #13

joelprestaworks opened this issue Dec 30, 2020 · 2 comments
Assignees
Labels

Comments

@joelprestaworks
Copy link

joelprestaworks commented Dec 30, 2020

Hi,

Nice package!

Im trying to use this to check which country specific IP-addresses belongs to, but: php artisan geo:info [IP (e.g. 122.11.11.14)], returns no data at all. Is this something that I should combine with anything else? Like a maxmind DB? If that's the case then I did not understand the documentation or where to configurate this.

I also added this to my .env-file:
GEOIP_COUNTRY=/storage/app/GeoLite2-Country.mmdb
GEOIP_CITY=/storage/app/GeoLite2-City.mmdb

and set true on country and city in my config/geo.php

Is it possible to get more information from you about this?

@kslimani kslimani self-assigned this Dec 30, 2020
@kslimani
Copy link
Owner

Hi,

If you set .mmdb files path using GEOIP_COUNTRY and GEOIP_CITY then you don't need to change default values in the config/geo.php file. (ie: don't set to true in geo.php)

File path should be relative to application root folder or can be any absolute path.

Example of relative path to laravel application storage :

GEOIP_COUNTRY=storage/app/GeoLite2-Country.mmdb

Example of an absolute path :

GEOIP_COUNTRY=/usr/share/GeoIP2/GeoLite2-Country.mmdb

Alternatively, you can also change default values in the config/geo.php file :

    /*
    |--------------------------------------------------------------------------
    | Location
    |--------------------------------------------------------------------------
    |
    | 'maxmind' is GeoIP2 .mmdb database files. (Set to false or empty
    | string to disable).
    */

    'location' => [
        'maxmind' => [
            'country' => '/usr/share/GeoIP2/GeoLite2-Country.mmdb', // Absolute path example
//            'country' => env('GEOIP_COUNTRY', false), // default value
            'city' => env('GEOIP_CITY', false),
            'isp' => env('GEOIP_ISP', false),
        ],
    ],

Additionally, if you prefer user another "location" db engine, you can write your own class. (take a look at phpunit location test file)

@joelprestaworks
Copy link
Author

Thank you, I did it correct the first time but missed to empty the cache. Awesome!

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

No branches or pull requests

2 participants