Git Product home page Git Product logo

geoip's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geoip's Issues

Use of undefined constant GEOIP_DRIVER - assumed 'GEOIP_DRIVER'

[2015-06-11 09:22:32] local.ERROR: exception 'ErrorException' with message 'Use of undefined constant GEOIP_DRIVER - assumed 'GEOIP_DRIVER'' in C:\Users\Marcin\Documents\NetBeansProjects\displate\vendor\pulkitjalan\geoip\src\config\config.php:12
Stack trace:
#0 C:\Users\Marcin\Documents\NetBeansProjects\displate\vendor\pulkitjalan\geoip\src\config\config.php(12): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Use of undefine...', 'C:\Users\Marcin...', 12, Array)
#1 C:\Users\Marcin\Documents\NetBeansProjects\displate\vendor\laravel\framework\src\Illuminate\Support\ServiceProvider.php(66): require('C:\Users\Marcin...')
#2 C:\Users\Marcin\Documents\NetBeansProjects\displate\vendor\pulkitjalan\geoip\src\GeoIPServiceProvider.php(38): Illuminate\Support\ServiceProvider->mergeConfigFrom('C:\Users\Marcin...', 'geoip')
#3 C:\Users\Marcin\Documents\NetBeansProjects\displate\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(499): PulkitJalan\GeoIP\GeoIPServiceProvider->register()
#4 C:\Users\Marcin\Documents\NetBeansProjects\displate\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php(74): Illuminate\Foundation\Application->register(Object(PulkitJalan\GeoIP\GeoIPServiceProvider))
#5 C:\Users\Marcin\Documents\NetBeansProjects\displate\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(475): Illuminate\Foundation\ProviderRepository->load(Array)
#6 C:\Users\Marcin\Documents\NetBeansProjects\displate\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\RegisterProviders.php(17): Illuminate\Foundation\Application->registerConfiguredProviders()
#7 C:\Users\Marcin\Documents\NetBeansProjects\displate\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(194): Illuminate\Foundation\Bootstrap\RegisterProviders->bootstrap(Object(Illuminate\Foundation\Application))
#8 C:\Users\Marcin\Documents\NetBeansProjects\displate\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(192): Illuminate\Foundation\Application->bootstrapWith(Array)
#9 C:\Users\Marcin\Documents\NetBeansProjects\displate\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(92): Illuminate\Foundation\Console\Kernel->bootstrap()
#10 C:\Users\Marcin\Documents\NetBeansProjects\displate\artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 {main}

[Symfony\Component\Debug\Exception\FatalThrowableError]

php artisan vendor:publish --provider="PulkitJalan\GeoIP\GeoIPServiceProvider" --tag="config"

[Symfony\Component\Debug\Exception\FatalThrowableError]
Call to undefined method Illuminate\Foundation\Application::share()

bindShared has been renamed to $app->singleton()

Laravel 8 Support

Laravel 8 uses Guzzle 7 by default. The Guzzle 6 requirement causes a collision.

Laravel 9 Support

Can this be updated to allow Laravel 9 support? Currently getting this when tried to install:

Problem 1
    - Root composer.json requires pulkitjalan/geoip ^5.1 -> satisfiable by pulkitjalan/geoip[5.1.0].
    - pulkitjalan/geoip 5.1.0 requires illuminate/support ^5.8|^6|^7|^8 -> found illuminate/support[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.

maxmind db not exist or readable

hey ,

I tried to use

$geoip = new GeoIP([
            'driver' => 'maxmind',
            'maxmind' => [
                'database' => public_path('geoip/geoip.mmdb'),
            ],
 ]);

and Laravel returns

The file "/var/www/html/test/public/geoip/geoip.mmdb" does not exist or is not readable.
 in Reader.php line 46
at Reader->__construct('/var/www/html/test/public/geoip/geoip.mmdb') in Reader.php line 52
at Reader->__construct('/var/www/html/test/public/geoip/geoip.mmdb') in MaxmindDriver.php line 116
at MaxmindDriver->createDatabase() in MaxmindDriver.php line 72
at MaxmindDriver->create() in MaxmindDriver.php line 25
at MaxmindDriver->__construct(array('database' => '/var/www/html/test/public/geoip/geoip.mmdb')) in GeoIPManager.php line 70
at GeoIPManager->createMaxmindDriver(array('database' => '/var/www/html/test/public/geoip/geoip.mmdb')) in GeoIPManager.php line 40
at GeoIPManager->getDriver() in GeoIP.php line 34
at GeoIP->__construct(array('driver' => 'maxmind', 'maxmind' => array('database' => '/var/www/html/test/public/geoip/geoip.mmdb'))) in TimeslotController.php line 314

However , the db exists and readable:

ls -la /var/www/html/test/public/geoip/geoip.mmdb
-rwxrwxrwx. 1 apache apache 32415987 Jul  8 19:50 /var/www/html/test/public/geoip/geoip.mmdb

Library not work with laravel 11

Library not work with laravel 11, because require illuminate/support 10 and laravel 11 work illuminate support 11 version

Problem 1
- Root composer.json requires pulkitjalan/geoip ^6.0 -> satisfiable by pulkitjalan/geoip[6.0.0].
- pulkitjalan/geoip 6.0.0 requires illuminate/support ^9|^10.0 -> found illuminate/support[v9.0.0, ..., v9.52.16, v10.0.0, ..., v10.48.2] but these were not loaded, likely because it conflicts with another require.

You can also try re-running composer require with an explicit version constraint, e.g. "composer require pulkitjalan/geoip:*" to figure out if any version is installable, or "composer require pulkitjalan/geoip:^2.1" if you know which you need.

GeoIPUpdater will stop working on December 30th

The URL used by GeoIPUpdater will shortly stop functioning.

Due to upcoming data privacy regulations, MaxMind are making significant changes to how users access free MaxMind GeoLite2 databases starting December 30, 2019. The databases will continue to be available without charge and for redistribution. However, you will be required to create an account and use a license key to download the databases, and agree to a new EULA that addresses applicable data privacy regulations.

Learn more on the MaxMind blog: https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/.

Mark Fowler
MaxMind

Caching?

Does it cache any of the results, or does it fetch a new time every request? It should really fetch responses from the IP-addresses.

rand() expects parameter 2 to be integer, string given

Hi there

very strange thing. I set up a new XAMMP and ran my application. Now when I run
$geoIp = GeoIP::getCountryCode();
I receive the following error

rand() expects parameter 2 to be integer, string given in [...]\pulkitjalan\geoip\src\GeoIP.php:76

/**
     * Get ip from server info.
     *
     * @return string ipaddress
     */
    public function getIp()
    {
        if (! $this->ip) {
            if ($this->random) {
                $this->ip = long2ip(rand(0, '4294967295'));   <<<<<<---- ERROR
            } else {
                $this->ip = array_get($_SERVER, 'HTTP_CLIENT_IP', array_get($_SERVER, 'HTTP_X_FORWARDED_FOR', array_get($_SERVER, 'HTTP_X_FORWARDED', array_get($_SERVER, 'HTTP_FORWARDED_FOR', array_get($_SERVER, 'HTTP_FORWARDED', array_get($_SERVER, 'REMOTE_ADDR', '127.0.0.1'))))));
            }
        }

If I change the marked line from long2ip(rand(0, '4294967295')); to long2ip(rand(0, 4294967295)); I get an error about the type being float not integer. If I then change it to long2ip(rand(0, 429496)); it works.

Now on my production system this works, only on my local machine not. But I have not upgraded this package in the last days, so this makes me wondering if this is now somehow broken?

Can anyone confirm this behaviour?

maxmind_database driver update failed

Hello,

I'm running Laravel 8.65.0 , I've get maxmind account and setup config file to use maxmind_database driver.
When I execute "php artisan geoip:update" I got "update failed" error message.

What I'm doing wrong?
Note that I've tried with geoipupdate 3.1.1 util and it works properly.

Regards

config is ignored

after recent updates config file is ignored and everything tries to connect to ip-api

config_path() undefined

Run:

php artisan vendor:publish --provider="PulkitJalan\GeoIP\GeoIPServiceProvider" --tag="config"

Error:

Call to undefined function PulkitJalan\GeoIP\config_path()

In GeoIPServiceProvider.

Composer require error

Composer error trying to require:
Argument 1 passed to PulkitJalan\GeoIP\Console\UpdateCommand::__construct() must be of the type array, null given, called in /Users/scottsmith/Developer/B3DB2/vendor/pulkitjalan/geoip/src/GeoIPServiceProvider.php on line 65

Same error with vendoer:publish

Does it expect a config to exist already before installing?

Maxmind database file does not exist in pipeline

We are using this package with the maxmind_database driver option. When running composer install and php artisan package:discover it fails due to the config database file path does not point to an existing file in the pipeline, thus the pipeline will fail with:

@php artisan package:discover
   PulkitJalan\GeoIP\Exceptions\InvalidCredentialsException 
  
  at vendor/pulkitjalan/geoip/src/Drivers/MaxmindDatabaseDriver.php:26
     22▕         $database = Arr::get($this->config, 'database', false);
     23▕ 
     24▕         // check if file exists first
     25▕         if (! $database || ! file_exists($database)) {
  ➜  26▕             throw new InvalidCredentialsException();
     27▕         }
     28▕ 
     29▕         // catch maxmind exception and throw geoip exception
     30▕         try {

This is with config containing:

'driver' => env('GEOIP_DRIVER', 'maxmind_database')

A workaround is to have the 'ip-api' as default for the driver, as it won't check for any existing databases:

'driver' => env('GEOIP_DRIVER', 'ip-api')

Though I would really like to keep the maxmind_database as the default.

Would it be possible to postpone file availability checking until the the point where a downloader could be invoked or the build is in it's destination environment where such a database is available?

Failed to get geoip data

Hi There, im not sure why but when i add our maxmind credentials to my env file i get the following error

"Failed to get geoip data" followed by
"Your user ID or license key could not be authenticated."

We know this is an active account as we're using it all the time on our old platform.

although we are not using lookups to maxmind but using our credentials to grab the latest database could that be it?

PHP 8.0 support

On PHP 8.0 one of the tests fails (test_ipstack_exception_getRaw). Unfortunately, I was unable to determine the source of the problem

Failed asserting that exception of type "PulkitJalan\GeoIP\Exceptions\GeoIPException" is thrown.

Lat & Lng being returned with comma when on different locale

I have just installed Localization support for my laravel 5 app, using the following two packages:

However, when I am on the danish language (which have thousandseperators as comma), lat & lng are being returned as:

55,6759

Instead of (on the default locale, english):

55.6759,0

This causes some SQL queries to fail.

Any ideas why? I assume the packages uses the native php function setlocale as well.

Conclusion: remove pulkitjalan/geoip dev-master

I am getting the following error when running composer update in my project now:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove pulkitjalan/geoip dev-master
    - Conclusion: remove guzzlehttp/guzzle 6.1.1
    - Conclusion: don't install guzzlehttp/guzzle 5.3.0
    - Conclusion: don't install guzzlehttp/guzzle 6.1.1
    - Installation request for pulkitjalan/geoip dev-master -> satisfiable by pulkitjalan/geoip[dev-master].
    - Installation request for tuurbo/spreedly ~1.5.0 -> satisfiable by tuurbo/spreedly[1.5.0].
    - pulkitjalan/geoip dev-master requires guzzlehttp/guzzle ~6 -> satisfiable by guzzlehttp/guzzle[6.1.1, 6.0.0, 6.0.1, 6.0.2, 6.1.0, 6.1.x-dev].
    - Can only install one of: guzzlehttp/guzzle[6.0.0, 5.2.0].
    - Can only install one of: guzzlehttp/guzzle[6.0.1, 5.2.0].
    - Can only install one of: guzzlehttp/guzzle[6.0.2, 5.2.0].
    - Can only install one of: guzzlehttp/guzzle[6.1.0, 5.2.0].
    - Can only install one of: guzzlehttp/guzzle[6.1.x-dev, 5.2.0].
    - tuurbo/spreedly 1.5.0 requires guzzlehttp/guzzle ~5.2 -> satisfiable by guzzlehttp/guzzle[5.2.0, 5.3.0, 5.3.x-dev].
    - Conclusion: don't install guzzlehttp/guzzle 5.3.x-dev

It used to work fine before.

Why?

Unable to run geoip:update (Out of memory error)

Using version 2.2.2 of this package on L5.2, when running the artisan command geoip:update I'm getting 'Cannot allocate memory' issues. (With 500mb of free ram) and a ascii is printed out to the console like so:

��h��h��h��h��h��h��h��h��h��h��h��h��h��h��h��h��h��h�� h��!h��"h��#h��$h��%h��&h��'h��(h��)h��*h��+h��,h��-h��.h��/h��0h��1h��2h��35�~4h��5h��6h��7h��8h��9h��:h��;h��<h��=h��>h��?h��@h��Ah��Bh��Ch��Dh��Eh��Fh��Gh��Hh��Ih��Jh��Kh��Lh��Mh��Nh��Oh��Ph��Q5�oRh��Sh��Th��Uh��Vh��Wh��Xh��Yh��Zh��[h��\h��]h��^h��_h��`h��a$S�b'kchd�se��f��g�h��hi j

See the stacktrace below:

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 88670208) (tried to allocate 76079136 bytes) in /home/forge/app/vendor/pulkitjalan/geoip/src/GeoIPUpdater.php on line 86

PHP Fatal error:  Uncaught ErrorException: proc_open(): fork failed - Cannot allocate memory in /home/forge/app/vendor/symfony/console/Application.php:898
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'proc_open(): fo...', '/home/forge/zen...', 898, Array)
#1 /home/forge/app/vendor/symfony/console/Application.php(898): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 /home/forge/app/vendor/symfony/console/Application.php(701): Symfony\Component\Console\Application->getSttyColumns()
#3 /home/forge/app/vendor/symfony/console/Application.php(662): Symfony\Component\Console\Application->getTerminalDimensions()
#4 /home/forge/app/vendor/symfony/console/Application.php(595): Symfony\Component\Console\Application->getTerminalWidth()
#5 /home/forge/app/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(141): Symfony\Component\Console\Application->renderException(Object(Symfony\Component\Debug\Excep in /home/forge/app/vendor/symfony/console/Application.php on line 898

Previously it worked fine and I don't recall making any changes that would have affected this. Has anyone else seen the same issue or have any ideas how to resolve it?

Thanks!

Nothing to publish for tag [config]

when I try :
php artisan vendor:publish --provider="pulkitjalan\geoip\GeoIPServiceProvider" --tag="config"
and get:
Nothing to publish for tag [config].

under laravel 5.1

[1.*] Composer dependency resolution fails

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - pulkitjalan/geoip 1.0.0 requires pulkitjalan/requester 1.* -> satisfiable by pulkitjalan/requester[1.0.0, 1.0.x-dev, 1.1.0].
    - pulkitjalan/geoip 1.0.1 requires pulkitjalan/requester 1.* -> satisfiable by pulkitjalan/requester[1.0.0, 1.0.x-dev, 1.1.0].
    - pulkitjalan/geoip 1.0.2 requires pulkitjalan/requester 1.* -> satisfiable by pulkitjalan/requester[1.0.0, 1.0.x-dev, 1.1.0].
    - pulkitjalan/geoip 1.0.3 requires pulkitjalan/requester 1.* -> satisfiable by pulkitjalan/requester[1.0.0, 1.0.x-dev, 1.1.0].
    - pulkitjalan/geoip 1.0.4 requires pulkitjalan/requester 1.* -> satisfiable by pulkitjalan/requester[1.0.0, 1.0.x-dev, 1.1.0].
    - pulkitjalan/geoip 1.0.5 requires pulkitjalan/requester 1.* -> satisfiable by pulkitjalan/requester[1.0.0, 1.0.x-dev, 1.1.0].
    - pulkitjalan/geoip 1.0.6 requires pulkitjalan/requester 1.* -> satisfiable by pulkitjalan/requester[1.0.0, 1.0.x-dev, 1.1.0].
    - pulkitjalan/geoip 1.0.x-dev requires pulkitjalan/requester 1.* -> satisfiable by pulkitjalan/requester[1.0.0, 1.0.x-dev, 1.1.0].
    - pulkitjalan/requester 1.0.0 requires guzzlehttp/guzzle 5.* -> satisfiable by guzzlehttp/guzzle[5.0.x-dev].
    - pulkitjalan/requester 1.0.x-dev requires guzzlehttp/guzzle ~5 -> satisfiable by guzzlehttp/guzzle[5.0.x-dev].
    - pulkitjalan/requester 1.1.0 requires guzzlehttp/guzzle ~5 -> satisfiable by guzzlehttp/guzzle[5.0.x-dev].
    - Conclusion: don't install guzzlehttp/guzzle 5.0.x-dev
    - Installation request for pulkitjalan/geoip 1.* -> satisfiable by pulkitjalan/geoip[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.x-dev].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.