PHPackages                             graymatterlabs/geoip - 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. graymatterlabs/geoip

ActiveLibrary

graymatterlabs/geoip
====================

GeoIp capable of supporting any Ip to geolocation service

v3.0(2y ago)0352[3 PRs](https://github.com/graymatterlabs/geoip/pulls)MITPHPPHP ^8.2

Since Aug 14Pushed 2y ago1 watchersCompare

[ Source](https://github.com/graymatterlabs/geoip)[ Packagist](https://packagist.org/packages/graymatterlabs/geoip)[ Docs](https://github.com/graymatterlabs/geoip)[ RSS](/packages/graymatterlabs-geoip/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (16)Used By (0)

GeoIp
=====

[](#geoip)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a5da702f561e29ff817448bce9342204ec3e3d125933e9183d9210d15540c41e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f677261796d61747465726c6162732f67656f69702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/graymatterlabs/geoip)[![Tests](https://github.com/graymatterlabs/geoip/actions/workflows/run-tests.yml/badge.svg?branch=master)](https://github.com/graymatterlabs/geoip/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/e31b84ac04a03a7ef9a4296359eadf4a0177b04639ceccfcc55449d3259fd9f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f677261796d61747465726c6162732f67656f69702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/graymatterlabs/geoip)

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

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require graymatterlabs/geoip:^3.0
```

Usage
-----

[](#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
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see the [Release Notes](../../releases) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Ryan Colson](https://github.com/ryancco)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 66.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 ~28 days

Recently: every ~56 days

Total

12

Last Release

1057d ago

Major Versions

v0.3.5 → v1.02023-03-20

v1.0 → v2.02023-06-04

v2.0 → v3.02023-06-18

PHP version history (3 changes)v0.1PHP ^8.0

v0.2PHP ^8.1

v1.0PHP ^8.2

### Community

Maintainers

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

---

Top Contributors

[![ryancco](https://avatars.githubusercontent.com/u/20148569?v=4)](https://github.com/ryancco "ryancco (24 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")

---

Tags

geoipgraymatterlabs

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/graymatterlabs-geoip/health.svg)

```
[![Health](https://phpackages.com/badges/graymatterlabs-geoip/health.svg)](https://phpackages.com/packages/graymatterlabs-geoip)
```

###  Alternatives

[geoip2/geoip2

MaxMind GeoIP2 PHP API

2.5k85.4M293](/packages/geoip2-geoip2)[torann/geoip

Support for multiple Geographical Location services.

2.2k14.2M76](/packages/torann-geoip)[maxmind-db/reader

MaxMind DB Reader API

69799.2M47](/packages/maxmind-db-reader)[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)[willdurand/geocoder

Common files for PHP Geocoder

17435.7M159](/packages/willdurand-geocoder)

PHPackages © 2026

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