PHPackages                             roomies/geolocatable - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. roomies/geolocatable

ActiveLibrary[HTTP &amp; Networking](/categories/http)

roomies/geolocatable
====================

Geolocate IP addresses using a variety of third-party services

1.2.0(1mo ago)12.3k↓50%MITPHPPHP ^8.3CI passing

Since Dec 16Pushed 1mo ago1 watchersCompare

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

READMEChangelogDependencies (20)Versions (6)Used By (0)

Roomies Geolocatable
====================

[](#roomies-geolocatable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2ab2949e10787399e9247b66bc71d59961d4cf47e204594151aee409d9fd2af3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f6f6d6965732f67656f6c6f63617461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/roomies/geolocatable)[![GitHub Tests Action Status](https://camo.githubusercontent.com/81f15169fd3c16c394a6ea550168845be06291e3246fa13eef5a5cf33d30f6ea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f726f6f6d6965732d636f6d2f67656f6c6f63617461626c652f746573742e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/roomies-com/geolocatable/actions?query=workflow%3Atest+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/7635c2660876271b4231909aabd1f5275f8f70cc8aa522b7a492002d6fb136fd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f6f6d6965732f67656f6c6f63617461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/roomies/geolocatable)

Determine the geographical location, currency and network information of website users based on their IP addresses.

Geolocatable is an abstraction over multiple IP geolocation services including [Cloudflare](https://www.cloudflare.com), [Ip2Location](https://www.ip2location.io), [ipapi.co](https://ipapi.co) [ipapi.com](https://ipapi.com), [ip-api.com](https://ip-api.com), [ipdata](https://ipdata.co), [Maxmind GeoIP database and web services](https://www.maxmind.com/en/home).

It's based off of [`laravel-geoip`](https://github.com/Torann/laravel-geoip), but there are some key differences that may affect your decision:

- it allows you to use multiple providers with different configurations,
- it doesn't implement caching behaviour,
- it doesn't implement a fallback/default location.

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

[](#installation)

You can install the package via Composer:

```
composer require roomies/geolocatable
```

You can publish the config file with:

```
php artisan vendor:publish --tag="geolocatable-config"
```

Read through the config file to understand the supported services and provide the correct configuration for your preferred services.

Getting started
---------------

[](#getting-started)

You can perform an IP address geolcaton using the Facade.

```
use Roomies\Geolocatable\Facades\Geolocation;

// Returns an instance of \Roomies\Geolocatable\Result\Geolocation
$result = Geolocate::ip('129.168.0.1');

echo "Looks like you are in {$result->country}, roughly around {$result->latitude}, {$result->longitude}.";
```

Depending on the provider you choose different combinations of information will be available. It will also depend specifically on the IP address itself and what data the provider has. However, Geolocatable returns a typed readonly class that provides access to structured attributes as well as the raw result if you require it.

- IP address
- location: `Roomies\Geolocatable\Result\Location`
    - continent name
    - country name and country ISO
    - state name and state ISO
    - city name
    - postal code
    - latitude
    - longitude
    - timezone
- network: `Roomies\Geolocatable\Result\Network`
    - organization
    - ISP
    - domain
    - is a proxy network
    - is a mobile network
    - is a hosting network
    - is an anonymous network
- currency: `Roomies\Geolocatable\Result\Currency`
    - name
    - code
    - symbol
- raw: the raw result from the geolocation provider

You can also change the provider you use on the fly.

```
Geolocate::using('maxmind_database')->ip('192.168.0.1');
```

### Cloudflare

[](#cloudflare)

If you have Cloudflare in front of your website you can [`add visitor location headers`](https://developers.cloudflare.com/network/ip-geolocation/#add-ip-geolocation-information) to your app using a managed transform. It doesn't have as much information as other providers and it can only be used for the IP address that makes the request, but it is a great free option if you don't need greater detail.

### [Ip2Location](https://www.ip2location.io)

[](#ip2location)

Ip2Location is a freemium service that starts at 30,000 lookups/month for free.

Check the config file or provide your `IP2LOCATION_KEY` in the environment.

### [ipapi.co](https://ipapi.co)

[](#ipapico)

ipapi is a freemium service.

### [ipapi.com](https://ipapi.com)

[](#ipapicom)

Proivide your `IPAPI_KEY` API key to use this API.

### [ip-api.com](https://ip-api.com)

[](#ip-apicom)

ip-api is a freemium service.

### [ipdata](https://ipdata.co)

[](#ipdata)

Provide your `IPDATA_KEY` API key to use this API.

### Maxmind Database

[](#maxmind-database)

Provide your Maxmind `account_id` and `license_key` to download the Maxmind database.

Once configured you need to install the `geoip2` dependency and then download the database.

```
composer require geoip2/geoip2
php artisan geolocatable:download
```

You can choose to update the database on your own schedule.

### Maxmind Web Services

[](#maxmind-web-services)

Provide your Maxmind `account_id` and `license_key` to use Maxmind Web Services.

By default it will use the `city` level for IP address details but you can control this.

Testing
-------

[](#testing)

Geolocatable includes a fake which makes it easy for you to test how your app handles different results. It allows you to stub the res

```
$result = new Roomies\Geolocatable\Result\Geolocation(
    source: 'fake',
    ipAddress: '192.168.0.1',
    raw: []
);

Geolocate::fake($result);
```

License
-------

[](#license)

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

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance89

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Total

4

Last Release

54d ago

### Community

Maintainers

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

---

Top Contributors

[![dwightwatson](https://avatars.githubusercontent.com/u/1100408?v=4)](https://github.com/dwightwatson "dwightwatson (14 commits)")

---

Tags

geolocationlaravellaravelgeocodinggeoipmaxmindgeocodeIP APIip-addressroomiesgeocodableipapigeolocatableip addressesipdata

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/roomies-geolocatable/health.svg)

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

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M531](/packages/laravel-passport)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

71510.9M66](/packages/laravel-mcp)

PHPackages © 2026

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