PHPackages                             arielmejiadev/geo-ip - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. arielmejiadev/geo-ip

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

arielmejiadev/geo-ip
====================

Resolve a visitor's country and location from their IP address in Laravel — modern syntax, swappable drivers (MaxMind GeoLite2, ip-api, ipinfo), zero external calls when you want them.

v1.0.3(1mo ago)016[5 PRs](https://github.com/ArielMejiaDev/geo-ip/pulls)MITPHPPHP ^8.2CI passing

Since May 29Pushed 1mo agoCompare

[ Source](https://github.com/ArielMejiaDev/geo-ip)[ Packagist](https://packagist.org/packages/arielmejiadev/geo-ip)[ Docs](https://github.com/arielmejiadev/geo-ip)[ GitHub Sponsors](https://github.com/ArielMejiaDev)[ RSS](/packages/arielmejiadev-geo-ip/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)Dependencies (28)Versions (10)Used By (0)

GeoIp for Laravel
=================

[](#geoip-for-laravel)

Resolve a visitor's country and geolocation from their IP address using swappable drivers — DB-IP Lite (default, free, no signup), MaxMind GeoLite2, ip-api, or ipinfo.

[![Latest Version on Packagist](https://camo.githubusercontent.com/9669070b870ff23cff2fad7751e60a2007a266decfcf8ecfa6d441a1c039cfb5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617269656c6d656a69616465762f67656f2d69702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/arielmejiadev/geo-ip)[![GitHub Tests Action Status](https://camo.githubusercontent.com/15f0999362eefa8dc47df7cec5e3c7da929a3c98d9c47d2985e59341eebc3aa3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f617269656c6d656a69616465762f67656f2d69702f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/arielmejiadev/geo-ip/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/95d0fe5634b87467798f64e38d32d3976252c2ca36087d6d68e48d4ab081a249/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f617269656c6d656a69616465762f67656f2d69702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/arielmejiadev/geo-ip)

Documentation
-------------

[](#documentation)

Full documentation is available at **[arielmejiadev.github.io/geo-ip](https://arielmejiadev.github.io/geo-ip/)**.

Quick Start
-----------

[](#quick-start)

```
composer require arielmejiadev/geo-ip
php artisan geo-ip:install
```

This publishes the config and downloads the free DB-IP Lite database (no signup or API key needed).

Usage
-----

[](#usage)

### One-shot lookups

[](#one-shot-lookups)

```
use ArielMejiaDev\GeoIp\Facades\GeoIp;

GeoIp::country('8.8.8.8');       // 'United States'
GeoIp::countryCode('8.8.8.8');   // 'US'
GeoIp::city('8.8.8.8');          // 'Mountain View'
GeoIp::timezone('8.8.8.8');      // 'America/Los_Angeles'
GeoIp::coordinates('8.8.8.8');   // ['latitude' => 37.386, 'longitude' => -122.084]
```

### Fluent API

[](#fluent-api)

```
$ip = GeoIp::of('8.8.8.8');

$ip->country();      // 'United States'
$ip->is('US');       // true
$ip->isIn(['US', 'CA', 'MX']); // true

// Conditional logic
GeoIp::of($ip)
    ->whenCountry('US', fn ($ip) => handleUs($ip))
    ->whenIn(['MX', 'CO', 'AR'], fn ($ip) => handleLatam($ip))
    ->toArray();

// From the current request
GeoIp::fromRequest()->countryCode();
```

Drivers
-------

[](#drivers)

DriverEnv ValueRequirementsDB-IP Lite`dbip` (default)`php artisan geo-ip:install`MaxMind GeoLite2`maxmind`License key + `php artisan geo-ip:install --maxmind`ip-api.com`ip-api`None (45 req/min limit)ipinfo.io`ipinfo``IPINFO_TOKEN`Null`null`None (for testing)Set the driver in `.env`:

```
GEOIP_DRIVER=dbip
```

Testing
-------

[](#testing)

```
composer test
```

Set the driver to `null` in your test environment to avoid external calls:

```

```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [ArielMejiaDev](https://github.com/ArielMejiaDev)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance91

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~4 days

Total

4

Last Release

44d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/31971074?v=4)[ArielMejiaDev](/maintainers/ArielMejiaDev)[@ArielMejiaDev](https://github.com/ArielMejiaDev)

---

Top Contributors

[![ArielMejiaDev](https://avatars.githubusercontent.com/u/31971074?v=4)](https://github.com/ArielMejiaDev "ArielMejiaDev (7 commits)")

---

Tags

laravelarielmejiadevGeo IP

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/arielmejiadev-geo-ip/health.svg)

```
[![Health](https://phpackages.com/badges/arielmejiadev-geo-ip/health.svg)](https://phpackages.com/packages/arielmejiadev-geo-ip)
```

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M48](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

330530.5k30](/packages/codewithdennis-filament-select-tree)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.8k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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