284

Product support

Get help in the plugin support forum.

  • Added on Sep 6, 2017
  • Current version: 1.0.2
  • Platform Compatibility
    v3.x not tested
    v2.x not tested
    v1.x use latest
  • Created by

Categories

Plugin allows to retrieve visitor's geo location data based on their IP address. Possible use cases:

  1. Show content (a greeting in visitors language for example) based on visitors location.
  2. Show estimated shipping costs based on visitors location.
  3. Perform any location specific marketing activities.
  4. You name it

A generic component is included that one can override as needed.

Raw PHP Usage

A Geo facade class is included. Usage is as simple as few lines of PHP code:

use Raccoon\GeoLocation\Facades\Geo;
$geoLocation = Geo::getLocation($ipAddress);

This call will return a GeoLocationItem object (please see documentation for more info).


Geo Service Configuration

At the moment you can choose between one of these geo location services:

  1. IPInfoDB
  2. MaxMind

Each of these have their own pros and cons. Please see documentation for more in depth explanation.


Demo

Please visit octoberraccoon.tk for a live demo with explanation.


Disclaimer

Please note that any geo location detection based on IP address is only an approximation. Please rate this plugin. Any feedback would be greatly appreciated.

Component showing plugin functionality

Geo Service Configuration

One can configure Geo service in backend settings by choosing one of these two services:
IPInfoDB - A free IP to geo location data API. Please register here to obtain your API key and store it in backend under plugin's settings. It is possible to configure this service to perform API calls either synchronously or asynchronously via the jobs queue. Synchronous approach will add 1-2 seconds in general to total page load time but with this approach you will have geo location resolved on the very first visitor's page view. Please note that already resolved geo locations are stored locally in database and will be reused for consecutive calls. Also please note that if you select asynchronous approach with Sync Queue Driver (Laravel default) any calls to IP Info DB API will still be synchronous.
Pros:

  • Free.
  • Frequent updates.

Cons:

  • Each API call requires 1-2 seconds.
  • Possible downtime.

MaxMind - Offers a downloadable free or paid IP geo location database file (.mmdb format). A free GeoLite 2 City database is included with this plugin and will be used as default. One can download latest GeoLite2 City database here. Store downloaded file in storage directory of your October project and provide path to database file in plugin's settings.
Pros:

  • No API calls to external service.
  • Offers free lite database version.

Cons:

  • Database needs to be updated from time to time
  • Free lite database version is outdated and might be less accurate

Raw PHP Usage

A Geo facade class is included. Usage is as simple as few lines of PHP code:

use Raccoon\GeoLocation\Facades\Geo;
$geoLocation = Geo::getLocation($ipAddress);

This call will always return a GeoLocationItem object with following properties available:

  • ipAddress
  • countryCode - ISO two letter country code
  • countryName - human readable country name
  • regionName - also known as state in some countries
  • cityName
  • zipCode - also known as postal code in some countries
  • latitude
  • longitude
  • timeZone - UTC+, a string in form of "+02:00"

A toArray() helper method is available on object. Please note that properties might be null for some IP addresses.

Component

A generic component that displays visitors geo location data is included with plugin. Feel free to override this component as needed.

Demo

Please visit octoberraccoon.tk for a live demo with explanation.

  • Found the plugin useful on 1 Feb, 2018

    Thank you for this plugin!

    It is exactly what i needed for my page. It took me not even 5 minutes to set up and restrict content to certain countries. Very useful!

1.0.2

Fix MaxMind null timezone error

Nov 01, 2018

1.0.1

First version of GeoLocation

Sep 06, 2017