Search by

internetdata / geocoder-php-provider

mslm

Official InternetData provider for Geocoder PHP. Geolocate an IPv4 or IPv6 address: country with no key, city, region, postal code and coordinates with one.

Package info

github.com/internetdata/sdk-php-geocoder

Homepage

pkg:composer/internetdata/geocoder-php-provider

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-23 10:16 UTC

This package is auto-updated.

Last update: 2026-11-23 10:21:34 UTC


README

Packagist license

The official Geocoder PHP provider for the InternetData API.

It geolocates IPv4 and IPv6 addresses. Without a key you get the country and timezone of every address. With a key on a paid plan, or within a free key's trial, you also get the city, region, postal code and coordinates.

Getting Started

composer require internetdata/geocoder-php-provider

Like every Geocoder provider it takes a PSR-18 HTTP client, so bring the one your project already uses, Guzzle or Symfony's for example.

use Geocoder\Query\GeocodeQuery;
use GuzzleHttp\Client;
use InternetData\Geocoder\InternetData;

$provider = new InternetData(new Client());

$address = $provider->geocodeQuery(GeocodeQuery::create('8.8.8.8'))->first();
echo $address->getCountry()->getCode();  // US
echo $address->getTimezone();            // America/Los_Angeles

To get the city and coordinates, pass your API key from your dashboard:

$provider = new InternetData(new Client(), getenv('INTERNETDATA_API_KEY'));

$address = $provider->geocodeQuery(GeocodeQuery::create('74.125.45.100'))->first();
echo $address->getLocality();                            // Tulsa
echo $address->getAdminLevels()->get(1)->getName();      // Oklahoma
echo $address->getCoordinates()->getLatitude();          // 36.15398

It works with StatefulGeocoder, ProviderAggregator and the Laravel and Symfony bundles like any other provider.

What it answers

Geocoder field Without a key Paid plan or trial
getCountry() code and name yes yes
getTimezone() yes yes
getLocality() (city) yes
getAdminLevels() level 1 (region, with its ISO 3166-2 code) yes
getPostalCode() yes
getCoordinates() yes

A private or reserved address, like 10.0.0.1, comes back as an empty collection, and 127.0.0.1 and ::1 as localhost without a request. A street address or a reverse query throws UnsupportedOperation, a wrong key InvalidCredentials and a spent quota QuotaExceeded. Plans and their limits are on the pricing page.

Other Libraries

There are official InternetData client libraries available for many languages including PHP, Python, Go, Java, and Ruby. See our GitHub at https://github.com/internetdata for more.

About InternetData

Geolocation, anonymity, ownership and network data for IP addresses, AS numbers and domains, as an API and as databases you download and query yourself.

InternetData

License

This project is licensed under the MIT License.