GeoIp capable of supporting any Ip to geolocation service

v3.0 2023-06-18 21:54 UTC

README

Latest Version on Packagist Tests Total Downloads

This package provides an opinionated framework for resolving geolocations from IP addresses.

Installation

You can install the package via composer:

composer require graymatterlabs/geoip:^3.0

Usage

use GrayMatterLabs\GeoIp\GeoIp;

// $locator = new GrayMatterLabs\GeoIp\Locators\Cached($locator, $cache);
$geoip = new GeoIp($locator);

$location = $geoip->locate($ip);

$location->getCountryCode(); // 'US'

if ($location->isDefault()) {
    //
}

Testing

composer test

Changelog

Please see the Release Notes for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.