[READ ONLY] Provider for GeoIP2
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Tests
.gitattributes
.gitignore
.travis.yml
CHANGELOG.md
GeoIP2.php
GeoIP2Adapter.php
LICENSE
Readme.md
composer.json
phpunit.xml.dist

Readme.md

GeoIP2 Geocoder provider

Build Status Latest Stable Version Total Downloads Monthly Downloads Quality Score Software License

This is the GeoIP2 provider from the PHP Geocoder. This is a READ ONLY repository. See the main repo for information and documentation.

Install

composer require geocoder-php/geoip2-provider

Note

It requires either the database file, or the webservice - represented by the GeoIP2 , which is injected to the GeoIP2Adapter.

This provider will only work with the corresponding GeoIP2Adapter:

// Maxmind GeoIP2 Provider: e.g. the database reader
$reader = new \GeoIp2\Database\Reader('/path/to/database');

$adapter = new \Geocoder\Adapter\GeoIP2Adapter($reader);
$geocoder = new \Geocoder\Provider\GeoIP2($adapter);

$address = $geocoder->geocode('74.200.247.59')->first();

Contribute

Contributions are very welcome! Send a pull request to the main repository or report any issues you find on the issue tracker.