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

ActiveFlarum-extension[Utility &amp; Helpers](/categories/utility)

fof/geoip
=========

IP Geolocation &amp; Security Insights

1.5.3(7mo ago)720.4k↓16%5[5 PRs](https://github.com/FriendsOfFlarum/geoip/pulls)MITPHPPHP ^8.0CI passing

Since Sep 28Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/FriendsOfFlarum/geoip)[ Packagist](https://packagist.org/packages/fof/geoip)[ Docs](https://friendsofflarum.org)[ Fund](https://opencollective.com/fof/donate)[ RSS](/packages/fof-geoip/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (52)Used By (0)

GeoIP by FriendsOfFlarum
========================

[](#geoip-by-friendsofflarum)

[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667) [![Latest Stable Version](https://camo.githubusercontent.com/f5278abd7255fe3a191d0cab9c40f0d8eadf9fa333d030abe43d28e46dfae0b6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666f662f67656f69702e737667)](https://packagist.org/packages/fof/geoip) [![OpenCollective](https://camo.githubusercontent.com/1903c197bb0307e60d6328653532b8a6b9890b898fbc92e314ab39d699491e74/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f70656e636f6c6c6563746976652d666f662d626c75652e737667)](https://opencollective.com/fof/donate) [![Donate](https://camo.githubusercontent.com/6c7b26396e320eb8dd60d767a4500684b60bb7d37f7cacbaf6b2eae6f2d30010/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d6461746974697365762d696d706f7274616e742e737667)](https://datitisev.me/donate)

A [Flarum](http://flarum.org) extension.

IP Geolocation &amp; Security Insights for Flarum
-------------------------------------------------

[](#ip-geolocation--security-insights-for-flarum)

Provide moderators with powerful IP geolocation tools for better forum management, while giving users visibility into their account access patterns and security. Moderators get comprehensive IP insights for moderation decisions, while users can monitor where their accounts are being accessed from for enhanced security awareness.

### 🌎 Key Features

[](#-key-features)

- **Location Insights**: Enable moderators to identify the country and region of users.
- **Interactive Mapping**: Let moderators visualize user locations with an integrated map view.
- **Threat Detection**: Equip moderators with the ability to highlight potentially malicious IP addresses through threat level indicators. (Via supported IP location data providers)

### 🔌 Supported IP Data Providers

[](#-supported-ip-data-providers)

GeoIP supports multiple IP lookup services, each with different features, rate limits, and data coverage:

**Default Provider**: The extension comes pre-configured with **IP-API** as the default provider since it requires no API key and allows you to get started immediately with up to 45 lookups per minute.

#### **IPData** (`ipdata`)

[](#ipdata-ipdata)

- **Service**:
- **Free Tier**: Up to 1,500 lookups daily
- **Paid Plans**: Available for higher usage limits
- **Requirements**: API key required
- **Data Provided**:
    - ✅ Country Code
    - ✅ Zip/Postal Code
    - ✅ Latitude/Longitude
    - ✅ ISP
    - ✅ Organization
    - ✅ ASN (Autonomous System Number)
    - ✅ Mobile/Cellular Detection
    - ✅ Threat Level Detection
    - ✅ Threat Type Classification (attacker/abuser)

#### **IP-API** (`ipapi`) - *Default*

[](#ip-api-ipapi---default)

- **Service**:
- **Free Tier**: Up to 45 lookups per minute
- **Rate Limiting**: Requests exceeding the limit are automatically queued and processed when the limit resets
- **Batch Support**: Yes (up to 15 batch requests per minute)
- **Automatic Retry**: Built-in retry logic for failed requests
- **Requirements**: No API key needed
- **Data Provided**:
    - ✅ Country Code
    - ✅ Zip/Postal Code
    - ✅ Latitude/Longitude
    - ✅ ISP
    - ✅ Organization
    - ✅ ASN (Autonomous System Number)
    - ✅ Mobile/Cellular Detection

#### **IP-API Pro** (`ipapi-pro`)

[](#ip-api-pro-ipapi-pro)

- **Service**:
- **Usage**: Unlimited lookups (paid service)
- **Requirements**: API key required
- **Data Provided**: Same as IP-API (inherits all features)
    - ✅ Country Code
    - ✅ Zip/Postal Code
    - ✅ Latitude/Longitude
    - ✅ ISP
    - ✅ Organization
    - ✅ ASN (Autonomous System Number)
    - ✅ Mobile/Cellular Detection

#### **IP Location** (`iplocation`)

[](#ip-location-iplocation)

- **Service**:
- **Rate Limits**: Unknown/undocumented
- **Requirements**: No API key needed
- **Data Provided** (Limited):
    - ✅ Country Code
    - ✅ ISP
    - ❌ No zip code, coordinates, or threat data

#### **7x Geolocation API** (`ipsevenex`)

[](#7x-geolocation-api-ipsevenex)

- **Service**:
- **Free Tier**: Up to 20 requests per minute with API key
- **Paid Plans**: Available for higher usage limits
- **Requirements**: API key required (free registration available)
- **Data Provided**:
    - ✅ Country Code
    - ✅ Zip/Postal Code
    - ✅ Latitude/Longitude
    - ✅ ISP
    - ✅ Organization

#### **IPInfo Lite** (`ipinfo-lite`)

[](#ipinfo-lite-ipinfo-lite)

- **Service**:
- **Usage**: No rate limiting or restrictions
- **Requirements**: API key required (free registration available)
- **Data Provided**:
    - ✅ Country Code
    - ✅ Organization (AS Name)
    - ✅ ISP (AS Domain)
    - ✅ ASN (Autonomous System Number)
    - ❌ No zip code, coordinates, mobile detection, or threat data

Choose the provider that best fits your forum's traffic volume, data requirements, and budget.

### 🔐 Permissions

[](#-permissions)

The extension provides the following permission:

- **Always display the country of the IP address** - Allows users to always see country flags, regardless of the post author's privacy settings

By default, only administrators and moderators can see IP addresses and detailed geolocation information.

### 👤 User Privacy Controls

[](#-user-privacy-controls)

Users have control over their location visibility:

- **Show country flag**: Users can opt-in to display their country flag on posts via their user preferences
- **IP addresses**: Only visible to administrators and moderators
- **Detailed location data**: Only accessible to administrators and moderators through the IP info modal

### Screenshots

[](#screenshots)

##### Redesigned meta info (visible to admins/mods)

[](#redesigned-meta-info-visible-to-adminsmods)

[![image](https://user-images.githubusercontent.com/16573496/269216977-b8814964-dfe7-4af9-b519-628506fbc109.png)](https://user-images.githubusercontent.com/16573496/269216977-b8814964-dfe7-4af9-b519-628506fbc109.png)

##### Integration with session management (visible to own profile)

[](#integration-with-session-management-visible-to-own-profile)

[![image](https://user-images.githubusercontent.com/16573496/269137486-b13008fa-a47b-4909-9e9e-d5d2eaa180d4.png)](https://user-images.githubusercontent.com/16573496/269137486-b13008fa-a47b-4909-9e9e-d5d2eaa180d4.png)

##### Information modal with location map

[](#information-modal-with-location-map)

[![image](https://user-images.githubusercontent.com/16573496/269137411-ae7657f1-38b5-46ba-9bd7-df802696a882.png)](https://user-images.githubusercontent.com/16573496/269137411-ae7657f1-38b5-46ba-9bd7-df802696a882.png)

### CLI Usage

[](#cli-usage)

The following CLI commands are provided:

#### `lookup`

[](#lookup)

Although IP addresses will be looked up when they are requested, this command will lookup all IP's that do not already have an entry in the `ip_info` table, using the currently selected provider.

```
php flarum fof:geoip:lookup
```

#### `lookup --force`

[](#lookup---force)

You may also force a refresh of IP data using the currently selected provider.

```
php flarum fof:geoip:lookup --force
```

### Queue offloading

[](#queue-offloading)

The IP lookup can be time consuming, so the lookup of an unknown IP address is dispatched in a job, if you have a queue running this will run on a worker thread, rather than the main thread.

All IP address lookup jobs are dispatched to the `default` queue by default. If you have multiple queues, you can specify which queue to use for these jobs in your `extend.php`:

```
FoF\GeoIP\Jobs\RetrieveIP::$onQueue = 'my-other-queue';

```

### Testing Your Configuration

[](#testing-your-configuration)

The extension includes a built-in service tester in the admin settings interface. After configuring your chosen IP lookup provider:

1. **Save your settings first** - The tester uses your currently saved configuration
2. **Navigate to the test section** - Located at the bottom of the GeoIP settings page
3. **Enter an IP address** - Use any valid IPv4 or IPv6 address (defaults to 8.8.8.8)
4. **Click "Test Service"** - This will make a real request to your configured provider

The test results will show:

- **Service response status** - Success or error indication
- **Response time** - How long the lookup took
- **HTTP status code** - The actual HTTP response code from the service
- **Processed data** - The clean, formatted IP information
- **Raw response details** - Complete HTTP headers and response body for debugging
- **Request details** - The exact URL and options used for the request

This testing feature is invaluable for:

- Verifying API keys are working correctly
- Checking service availability and response times
- Debugging configuration issues
- Understanding what data your chosen provider returns

### 🔧 Troubleshooting

[](#-troubleshooting)

#### Common Issues

[](#common-issues)

**IP lookups not working**

1. Check your service configuration in the admin panel
2. Use the built-in service tester to verify your setup
3. Ensure your API key is valid (for services that require one)
4. Check the Flarum logs for error messages

**Rate limit exceeded**

- IP-API: Requests are automatically queued, wait for the next minute
- IPData: Check your daily quota usage
- Consider upgrading to a paid plan for higher limits

**No country flags showing**

1. Ensure "Show country flag for each post" is enabled in settings
2. Users must opt-in via their preferences (unless admin permission overrides this)
3. Check that the IP lookup returned valid country data

**Queue not processing**

- Ensure your queue worker is running: `php flarum queue:work`
- Check queue configuration in your hosting environment

### ⚡ Performance Considerations

[](#-performance-considerations)

- **Queue Processing**: IP lookups are processed in background jobs to avoid blocking page loads
- **Caching**: Results are cached to avoid repeated API calls for the same IP
- **Rate Limiting**: Built-in rate limiting prevents API quota exhaustion
- **Batch Processing**: Some providers support batch lookups for better efficiency

For high-traffic forums, consider:

- Using a paid provider with higher rate limits
- Ensuring your queue worker is properly configured
- Monitoring your API usage through provider dashboards

### 📊 Data Storage

[](#-data-storage)

- IP geolocation data is stored locally in your database after lookup
- Data includes: country, coordinates, ISP, organization, and threat information (where available)
- No personal user data is sent to IP lookup providers
- Only IP addresses are transmitted for geolocation lookup

### Installation

[](#installation)

Install manually with composer:

```
composer require fof/geoip:"*"
```

### Updating

[](#updating)

```
composer update fof/geoip
php flarum cache:clear
```

### Links

[](#links)

[![OpenCollective](https://camo.githubusercontent.com/8ea53c451470d1a72789d650c77e2b22eee915f7fbf2cbeeeeaa25f47301efe2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d667269656e64736f66666c6172756d2d3434414545353f7374796c653d666f722d7468652d6261646765266c6f676f3d6f70656e2d636f6c6c656374697665)](https://opencollective.com/fof/donate) [![GitHub](https://camo.githubusercontent.com/19562cc0996a556a7abda08327f57924e288bbbc3c5312b096c62175a2841ae4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d6461746974697365762d6561346161613f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562)](https://datitisev.me/donate/github)

- [Packagist](https://packagist.org/packages/fof/geoip)
- [GitHub](https://github.com/FriendsOfFlarum/geoip)

An extension by [FriendsOfFlarum](https://github.com/FriendsOfFlarum).

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance74

Regular maintenance activity

Popularity35

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity76

Established project with proven stability

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

Recently: every ~11 days

Total

44

Last Release

91d ago

Major Versions

0.4.0 → 1.0.02021-05-20

1.5.3 → 2.0.0-beta.12025-11-07

1.x-dev → 2.0.0-beta.42026-02-16

### Community

Maintainers

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

![](https://avatars.githubusercontent.com/u/1630413?v=4)[Gregor Hammerschmidt](/maintainers/GreXXL)[@GreXXL](https://github.com/GreXXL)

![](https://www.gravatar.com/avatar/0538135c1debcef5602dce7ece027909cc832b7a6284ab9189a19aa8de98d60d?d=identicon)[clarkwinkelmann](/maintainers/clarkwinkelmann)

![](https://www.gravatar.com/avatar/1298cdc0b2402a1aa34fb75a254947d655e090d62bd0531311331d369cac934e?d=identicon)[datitisev](/maintainers/datitisev)

---

Top Contributors

[![imorland](https://avatars.githubusercontent.com/u/16573496?v=4)](https://github.com/imorland "imorland (57 commits)")[![flarum-bot](https://avatars.githubusercontent.com/u/39334649?v=4)](https://github.com/flarum-bot "flarum-bot (31 commits)")[![dsevillamartin](https://avatars.githubusercontent.com/u/6401250?v=4)](https://github.com/dsevillamartin "dsevillamartin (29 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (16 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (4 commits)")[![karaok491](https://avatars.githubusercontent.com/u/72854852?v=4)](https://github.com/karaok491 "karaok491 (3 commits)")[![halillusion](https://avatars.githubusercontent.com/u/15546477?v=4)](https://github.com/halillusion "halillusion (1 commits)")[![luceos](https://avatars.githubusercontent.com/u/504687?v=4)](https://github.com/luceos "luceos (1 commits)")[![meezaan](https://avatars.githubusercontent.com/u/1839282?v=4)](https://github.com/meezaan "meezaan (1 commits)")[![askvortsov1](https://avatars.githubusercontent.com/u/38059171?v=4)](https://github.com/askvortsov1 "askvortsov1 (1 commits)")

---

Tags

flarumfriendsofflarumhacktoberfestflarum

### Embed Badge

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

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

###  Alternatives

[fof/byobu

Well integrated, advanced private discussions.

61105.8k9](/packages/fof-byobu)[fof/user-bio

Add a user bio to user profiles

2196.5k9](/packages/fof-user-bio)[fof/sitemap

Generate a sitemap

1988.7k2](/packages/fof-sitemap)[fof/drafts

Allow users to create post and discussion drafts

1771.1k5](/packages/fof-drafts)

PHPackages © 2026

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