geocoder-php/geoip2-provider

4.0.1 2018-03-03 14:09 UTC

README

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.