Researched GeoIP solutions for Commerce 2.x: #2639280: Integrate with a GeoIP solution.
This module makes the most sense.

A D8 codebase would limit itself to the v2 API, get the library via Composer, and define a plugin type for GeoHandlers (or whatever they end up being called).
One plugin could support getting the info from $_SERVER (for CDNs), the other could use the maxmind library/db itself.
The plugin API allows for plugins to have settings (credentials, path to a db file, etc). The main method would return a value object with the result (country code, continent, etc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bojanz created an issue. See original summary.

mglaman’s picture

Issue summary: View changes
FileSize
75.14 KB

I've got a working port here: https://github.com/mglaman/geoip.

Here's result using Devel's PHP form and the Local (Maxmind) plugin

mglaman’s picture

Status: Active » Needs review
FileSize
75.19 KB

Here is my patch for the port, found here https://github.com/mglaman/geoip. I've got it working where it

  • Lets you select the default GeoLocator plugin to use (Local [Maxmind], or CDN)
  • Provides a service for geolocating
  • Returns Country object provided by CommerceGuys\Intl via Address module integration for Country repository.
colan’s picture

Status: Needs review » Needs work

Thanks for the patch!

Looks like it depends on Composer Manager , which is now deprecated given the Composer support in Drupal core 8.1.x. The installation instructions & such should be updated just as Address was.

bojanz’s picture

We also need to remove the Address dependency, no reason to have it. The moduile should use its own value object for the result.

das-peter’s picture

@mglaman Thank you very much for porting & sorry for my horrible response time. I just created a 8.x-2.x branch, committed & pushed the patch and for your convenience I added you as maintainer. So if you like feel free to go ahead and push directly to the new 8.x branch.
As soon the branch shows up on d.o. I'll activate dev releases too.

colan’s picture

Issue tags: +Needs followup

As #3 was committed, we need to create follow-up issues for #4 and #5.

colan’s picture

Version: 7.x-2.x-dev » 8.x-2.x-dev

Updating version.

colan’s picture

I just found out about the Smart IP module via #2755723: Support geo-IP lookup option in default currency selector, which has had a stable Drupal 8 release for almost a year. As we don't have one here yet, should we redirect our energies towards that module and deprecate this one (for D8)? It would be a shame to duplicate our efforts.

bojanz’s picture

@colan
Matt and I will be continuing to devote our attention to this module.
We use it for Commerce sites, and prefer its architecture.

colan’s picture

#11: Sounds good. In that case, could we list the other one as an alternative module on the project page? Thanks.

sumanthkumarc’s picture

@colan , i used the d8 version of this module for production and works fine. I prefer this over other ip lookup modules.

nterbogt’s picture

Is a stable release of the 8.x branch scheduled?

bojanz’s picture

Status: Needs work » Fixed

I've tagged a beta1, let's continue discussing the plans for RC1 and beyond in #3013319: 8.x-2.0 stable roadmap.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.