PHPackages                             interaction-design-foundation/laravel-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. interaction-design-foundation/laravel-geoip

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

interaction-design-foundation/laravel-geoip
===========================================

Support for multiple Geographical Location services.

4.3.0(3mo ago)19267.9k↑17.6%33BSD-2-ClausePHPPHP ^8.3CI passing

Since Dec 12Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/InteractionDesignFoundation/laravel-geoip)[ Packagist](https://packagist.org/packages/interaction-design-foundation/laravel-geoip)[ RSS](/packages/interaction-design-foundation-laravel-geoip/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (39)Versions (78)Used By (3)

GeoIP for Laravel
=================

[](#geoip-for-laravel)

[![run-tests](https://github.com/InteractionDesignFoundation/laravel-geoip/actions/workflows/run-tests.yml/badge.svg)](https://github.com/InteractionDesignFoundation/laravel-geoip/actions/workflows/run-tests.yml)[![Type coverage](https://camo.githubusercontent.com/3bace52c1359596574795a3904717b00411a6c328a0e87cb7c1ede7e28210376/68747470733a2f2f73686570686572642e6465762f6769746875622f496e746572616374696f6e44657369676e466f756e646174696f6e2f6c61726176656c2d67656f69702f636f7665726167652e737667)](https://shepherd.dev/github/InteractionDesignFoundation/laravel-geoip)[![Psalm error level](https://camo.githubusercontent.com/3f35770dbd9811e064cd3442091bedfb1e502932a921be45765c86929eef4a1b/68747470733a2f2f73686570686572642e6465762f6769746875622f496e746572616374696f6e44657369676e466f756e646174696f6e2f6c61726176656c2d67656f69702f6c6576656c2e737667)](https://shepherd.dev/github/InteractionDesignFoundation/laravel-geoip)

Determine the geographical location and currency of website visitors based on their IP addresses.

> Actively maintained fork of [`torann/geoip`](https://github.com/Torann/laravel-geoip) with modern PHP/Laravel support, better types, and additional features. [Migration guide](./docs/migration.md).

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

[](#installation)

```
composer require interaction-design-foundation/laravel-geoip
```

Publish the config file:

```
php artisan vendor:publish --provider="InteractionDesignFoundation\GeoIP\GeoIPServiceProvider" --tag=config
```

Set the `GEOIP_SERVICE` env variable to one of the [supported services](#services).

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

[](#quick-start)

Use the `geoip()` helper or the `GeoIP` facade:

```
// Get location for an IP
$location = geoip('203.0.113.1');

// Get location for the current visitor
$location = geoip()->getLocation();

// Access location data
$location->city;       // "New Haven"
$location->country;    // "United States"
$location->iso_code;   // "US"
$location->timezone;   // "America/New_York"
$location->currency;   // "USD"
```

The `Location` object contains: `ip`, `iso_code`, `country`, `city`, `state`, `state_name`, `postal_code`, `lat`, `lon`, `timezone`, `continent`, `currency`, `default`, and `cached`.

It implements `ArrayAccess`, so both `$location->city` and `$location['city']` work.

Services
--------

[](#services)

Set the service via the `GEOIP_SERVICE` env variable or in `config/geoip.php`:

ServiceKeyRequires[MaxMind Database](https://www.maxmind.com/en/geoip2-databases)`maxmind_database``geoip2/geoip2` package + license key[MaxMind Web API](https://www.maxmind.com/en/geoip2-precision-services)`maxmind_api``geoip2/geoip2` package + user ID &amp; license key[IP-API](https://ip-api.com/)`ipapi`API key (for HTTPS)[IPGeolocation](https://ipgeolocation.io/)`ipgeolocation`API key[IPData](https://ipdata.co/)`ipdata`API key[IPFinder](https://ipfinder.io/)`ipfinder`API key[IP2Location](https://www.ip2location.io/)`ip2location`API keyFor detailed service configuration, see [services documentation](./docs/services.md).

Configuration
-------------

[](#configuration)

Key options in `config/geoip.php`:

### Caching

[](#caching)

GeoIP caches lookups using Laravel's cache system to reduce API calls. Set the `cache` option to:

- `all` -- cache all lookups
- `some` -- cache only the current user's lookup
- `none` -- disable caching

You can also configure `cache_tags`, `cache_expires` (TTL in seconds), and `cache_prefix`.

### Currency Detection

[](#currency-detection)

When `include_currency` is enabled (default), the package resolves the visitor's currency from their country ISO code using the [league/iso3166](https://github.com/thephpleague/iso3166) package.

### Default Location

[](#default-location)

Configure a fallback location returned when a lookup fails or the IP is local/invalid.

Artisan Commands
----------------

[](#artisan-commands)

```
# Download/update the local GeoIP database (required for maxmind_database)
php artisan geoip:update

# Clear cached locations
php artisan geoip:clear
```

Changelog
---------

[](#changelog)

See [Releases](https://github.com/InteractionDesignFoundation/laravel-geoip/releases) for what has changed recently.

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

[](#contributing)

See [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

###  Health Score

66

—

FairBetter than 99% of packages

Maintenance82

Actively maintained with recent releases

Popularity44

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity93

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~78 days

Recently: every ~96 days

Total

58

Last Release

92d ago

Major Versions

0.2.3 → 1.0.02016-10-03

0.2.4 → 1.0.32017-01-26

0.2.5 → 1.0.42017-06-21

1.2.1 → 3.0.12020-09-10

3.7.4 → 4.0.0-rc12025-03-11

PHP version history (11 changes)0.1.0PHP &gt;=5.3.0

1.0.0PHP &gt;=5.5.9

1.0.9PHP ^7.0

1.0.10PHP ^7.1

1.2.0PHP ^7.2

3.0.2PHP ^7.2 || ^8.0

3.1.0PHP ^8.0|^8.1

3.1.1PHP ^8.0

3.4.0PHP ^8.1

4.1.0PHP ^8.2

4.2.0PHP ^8.3

### Community

Maintainers

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

---

Top Contributors

[![alies-dev](https://avatars.githubusercontent.com/u/5278175?v=4)](https://github.com/alies-dev "alies-dev (168 commits)")[![Torann](https://avatars.githubusercontent.com/u/1406755?v=4)](https://github.com/Torann "Torann (108 commits)")[![dotpack](https://avatars.githubusercontent.com/u/1175814?v=4)](https://github.com/dotpack "dotpack (10 commits)")[![lptn](https://avatars.githubusercontent.com/u/150333538?v=4)](https://github.com/lptn "lptn (9 commits)")[![jessarcher](https://avatars.githubusercontent.com/u/4977161?v=4)](https://github.com/jessarcher "jessarcher (6 commits)")[![dwightwatson](https://avatars.githubusercontent.com/u/1100408?v=4)](https://github.com/dwightwatson "dwightwatson (6 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 commits)")[![highstrike](https://avatars.githubusercontent.com/u/2379538?v=4)](https://github.com/highstrike "highstrike (3 commits)")[![kyranb](https://avatars.githubusercontent.com/u/5426926?v=4)](https://github.com/kyranb "kyranb (3 commits)")[![osmhub](https://avatars.githubusercontent.com/u/13149318?v=4)](https://github.com/osmhub "osmhub (3 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![Pythagus](https://avatars.githubusercontent.com/u/34168890?v=4)](https://github.com/Pythagus "Pythagus (2 commits)")[![LukeT](https://avatars.githubusercontent.com/u/2203091?v=4)](https://github.com/LukeT "LukeT (2 commits)")[![rjp2525](https://avatars.githubusercontent.com/u/1334865?v=4)](https://github.com/rjp2525 "rjp2525 (2 commits)")[![mithredate](https://avatars.githubusercontent.com/u/6016632?v=4)](https://github.com/mithredate "mithredate (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")[![janicerar](https://avatars.githubusercontent.com/u/29040621?v=4)](https://github.com/janicerar "janicerar (2 commits)")[![Butochnikov](https://avatars.githubusercontent.com/u/4212297?v=4)](https://github.com/Butochnikov "Butochnikov (2 commits)")[![rasoulrahimii](https://avatars.githubusercontent.com/u/24825810?v=4)](https://github.com/rasoulrahimii "rasoulrahimii (1 commits)")[![sakalauskas](https://avatars.githubusercontent.com/u/1455148?v=4)](https://github.com/sakalauskas "sakalauskas (1 commits)")

---

Tags

geolocationipapiipdataipfinderipgeolocationlaravellaravel-geolocationlaravel-packagemaxdbmaxmindmaxmind-geoiplaravelgeoipgeolocationlocationgeographicalIP APIinfoDB

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/interaction-design-foundation-laravel-geoip/health.svg)

```
[![Health](https://phpackages.com/badges/interaction-design-foundation-laravel-geoip/health.svg)](https://phpackages.com/packages/interaction-design-foundation-laravel-geoip)
```

###  Alternatives

[torann/geoip

Support for multiple Geographical Location services.

2.2k15.3M98](/packages/torann-geoip)[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M7](/packages/propaganistas-laravel-disposable-email)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k9.0M69](/packages/spatie-laravel-responsecache)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.9k1](/packages/mike-bronner-laravel-model-caching)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M194](/packages/laravel-ai)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)

PHPackages © 2026

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