PHPackages                             geocoder-php/geoip2-provider - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. geocoder-php/geoip2-provider

ActiveLibrary

geocoder-php/geoip2-provider
============================

Geocoder GeoIP2 adapter

4.4.0(1y ago)5867.3k—0.2%6MITPHPPHP ^8.0CI failing

Since Jun 30Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/geocoder-php/geoip2-provider)[ Packagist](https://packagist.org/packages/geocoder-php/geoip2-provider)[ Docs](http://geocoder-php.org/Geocoder/)[ RSS](/packages/geocoder-php-geoip2-provider/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (4)Versions (7)Used By (6)

GeoIP2 Geocoder provider
========================

[](#geoip2-geocoder-provider)

[![Build Status](https://camo.githubusercontent.com/2719a99a09068fd04f50f43627a79ac034118bb06e2ec2905639d87adeb2dc56/68747470733a2f2f7472617669732d63692e6f72672f67656f636f6465722d7068702f67656f6970322d70726f76696465722e7376673f6272616e63683d6d6173746572)](http://travis-ci.org/geocoder-php/geoip2-provider)[![Latest Stable Version](https://camo.githubusercontent.com/fc7431c9bb9e1e95cebc6b1132dbcfa79bcef7e2a0793e542ecf7e4da9a35912/68747470733a2f2f706f7365722e707567782e6f72672f67656f636f6465722d7068702f67656f6970322d70726f76696465722f762f737461626c65)](https://packagist.org/packages/geocoder-php/geoip2-provider)[![Total Downloads](https://camo.githubusercontent.com/5f06bc7bb806040eeee3849f74341159fd946e9d1f8f0c9f29d3c565b6c3104c/68747470733a2f2f706f7365722e707567782e6f72672f67656f636f6465722d7068702f67656f6970322d70726f76696465722f646f776e6c6f616473)](https://packagist.org/packages/geocoder-php/geoip2-provider)[![Monthly Downloads](https://camo.githubusercontent.com/c6aecc73105cabe53fb8ed6b6e6fd90ebfbd4202f0eb2656a891f5b4976aaf30/68747470733a2f2f706f7365722e707567782e6f72672f67656f636f6465722d7068702f67656f6970322d70726f76696465722f642f6d6f6e74686c792e706e67)](https://packagist.org/packages/geocoder-php/geoip2-provider)[![Quality Score](https://camo.githubusercontent.com/d64f867187c3d49a3115235ac1a69e323ed27639468ae1d61b86622d4e6f2ed5/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f67656f636f6465722d7068702f67656f6970322d70726f76696465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/geocoder-php/geoip2-provider)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

This is the GeoIP2 provider from the PHP Geocoder. This is a **READ ONLY** repository. See the [main repo](https://github.com/geocoder-php/Geocoder) for information and documentation.

### Install

[](#install)

```
composer require geocoder-php/geoip2-provider
```

Usage
-----

[](#usage)

The provider requires either a database file, or paid access to the web service.

### Using a database file

[](#using-a-database-file)

Both free [geolite2](https://dev.maxmind.com/geoip/geoip2/geolite2/) and the paid precision [city](https://www.maxmind.com/en/geoip2-city) and [country](https://www.maxmind.com/en/geoip2-country-database)databases are supported.

```
//Use a Maxmind GeoIP2 Database:
$reader = new \GeoIp2\Database\Reader('/path/to/geolite2.mmdb');

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

$address = $geocoder->geocodeQuery(\Geocoder\Query\GeocodeQuery::create('74.200.247.59'))->first();
```

### Using the Precision Web Service (API)

[](#using-the-precision-web-service-api)

The provider also support the Precision Web Services. Please note that these API are paid, and billed per request.

```
// Use the Maxmind GeoIP2 API:
$reader = new \GeoIp2\WebService\Client(, '');

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

$address = $geocoder->geocodeQuery(\Geocoder\Query\GeocodeQuery::create('74.200.247.59'))->first();
```

### Contribute

[](#contribute)

Contributions are very welcome! Send a pull request to the [main repository](https://github.com/geocoder-php/Geocoder) or report any issues you find on the [issue tracker](https://github.com/geocoder-php/Geocoder/issues).

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance59

Moderate activity, may be stable

Popularity42

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 50.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~569 days

Recently: every ~650 days

Total

6

Last Release

399d ago

PHP version history (5 changes)4.0.0PHP ^7.0

4.1.0PHP ^7.2

4.2.0PHP ^7.3 || ^8.0

4.3.0PHP ^7.4 || ^8.0

4.4.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/401ccc5eea13c60cf807ae982af00e368e2166e2f26d8eb541dcd881a57385bc?d=identicon)[Nyholm](/maintainers/Nyholm)

![](https://www.gravatar.com/avatar/b434ff5f6f9dcc7095f45c43254299b3cc8f6c83e9a757a80a6b7d229a4c9701?d=identicon)[jbelien](/maintainers/jbelien)

---

Top Contributors

[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (34 commits)")[![jbelien](https://avatars.githubusercontent.com/u/1150563?v=4)](https://github.com/jbelien "jbelien (18 commits)")[![Chris53897](https://avatars.githubusercontent.com/u/7104259?v=4)](https://github.com/Chris53897 "Chris53897 (7 commits)")[![kornrunner](https://avatars.githubusercontent.com/u/725986?v=4)](https://github.com/kornrunner "kornrunner (1 commits)")[![nicolas-grekas](https://avatars.githubusercontent.com/u/243674?v=4)](https://github.com/nicolas-grekas "nicolas-grekas (1 commits)")[![norkunas](https://avatars.githubusercontent.com/u/2722872?v=4)](https://github.com/norkunas "norkunas (1 commits)")[![redthor](https://avatars.githubusercontent.com/u/767896?v=4)](https://github.com/redthor "redthor (1 commits)")[![atymic](https://avatars.githubusercontent.com/u/50683531?v=4)](https://github.com/atymic "atymic (1 commits)")[![rtmotiondev](https://avatars.githubusercontent.com/u/54023781?v=4)](https://github.com/rtmotiondev "rtmotiondev (1 commits)")[![fbuchlak](https://avatars.githubusercontent.com/u/30214087?v=4)](https://github.com/fbuchlak "fbuchlak (1 commits)")[![JaZo](https://avatars.githubusercontent.com/u/3475007?v=4)](https://github.com/JaZo "JaZo (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/geocoder-php-geoip2-provider/health.svg)

```
[![Health](https://phpackages.com/badges/geocoder-php-geoip2-provider/health.svg)](https://phpackages.com/packages/geocoder-php-geoip2-provider)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.4k37.3k](/packages/matomo-matomo)[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[geocoder-php/common-http

Common files for HTTP based Geocoders

18722.1M64](/packages/geocoder-php-common-http)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
