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

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

salmaabdelhady/lumen-geoip
==========================

GeoIP for Lumen

2.0.3(8y ago)0117MITPHPPHP &gt;=7.0

Since Oct 13Pushed 8y agoCompare

[ Source](https://github.com/SalmaAbdelhady/lumen-geoip)[ Packagist](https://packagist.org/packages/salmaabdelhady/lumen-geoip)[ RSS](/packages/salmaabdelhady-lumen-geoip/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (8)Used By (0)

GeoIP for Lumen
===============

[](#geoip-for-lumen)

[![Latest Stable Version](https://camo.githubusercontent.com/5061a7a569443c926f8b3d877fe1b56b7a9b523e122e3113d9df3050c68a9934/68747470733a2f2f706f7365722e707567782e6f72672f73616c6d61616264656c686164792f6c756d656e2d67656f69702f762f737461626c65)](https://packagist.org/packages/salmaabdelhady/lumen-geoip) [![Total Downloads](https://camo.githubusercontent.com/a1f6937e07d4ce06e9d06fcdf8dfc9593d451c0f2148a54b328de3e57a0d2dff/68747470733a2f2f706f7365722e707567782e6f72672f73616c6d61616264656c686164792f6c756d656e2d67656f69702f646f776e6c6f616473)](https://packagist.org/packages/salmaabdelhady/lumen-geoip) [![Latest Unstable Version](https://camo.githubusercontent.com/55a897e22c405626c1f719d7a768bb4902d8e38e4201b6b1d1bd211deb371908/68747470733a2f2f706f7365722e707567782e6f72672f73616c6d61616264656c686164792f6c756d656e2d67656f69702f762f756e737461626c65)](https://packagist.org/packages/salmaabdelhady/lumen-geoip) [![License](https://camo.githubusercontent.com/2036f10bbb41591ffdc2baa0b34faa0e29dd71a1a66e9f3d43fa10dcc63fa92b/68747470733a2f2f706f7365722e707567782e6f72672f73616c6d61616264656c686164792f6c756d656e2d67656f69702f6c6963656e7365)](https://packagist.org/packages/salmaabdelhady/lumen-geoip)

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

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

[](#installation)

To install this package, just install through composer

```
$ composer require salmaabdelhady/lumen-geoip

```

### Providers

[](#providers)

Next, open `bootstrap/app.php` and add under the Register Service Providers section:

```
...
$app->register(Codenexus\GeoIP\GeoIPServiceProvider::class);
```

### Update MaxMind GeoLite2 City database

[](#update-maxmind-geolite2-city-database)

Run this on the command line from the root of your project:

```
$ php artisan geoip:update

```

### Usage

[](#usage)

GeoIP will try to determine the IP using the following http headers: `HTTP_CLIENT_IP`, `HTTP_X_FORWARDED_FOR`, `HTTP_X_FORWARDED`, `HTTP_X_CLUSTER_CLIENT_IP`, `HTTP_FORWARDED_FOR`, `HTTP_FORWARDED`, `REMOTE_ADDR` in this order. Optionally you can set an IP as the only parameter to set it.

```
$record = app()->geoip->getLocation('232.223.11.11');
$record = GeoIP::getLocation('232.223.11.11'); // If you have enabled facades

print($record->country->isoCode . "\n"); // 'US'
print($record->country->name . "\n"); // 'United States'
print($record->country->names['zh-CN'] . "\n"); // '美国'

print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'

print($record->city->name . "\n"); // 'Minneapolis'

print($record->postal->code . "\n"); // '55455'

print($record->location->latitude . "\n"); // 44.9733
print($record->location->longitude . "\n"); // -93.2323
```

### Other Methods

[](#other-methods)

These methods are also available to use within your applications.

```
app()->geoip->checkIp($ip) // Checks IP to make sure IP is a valid IPv4 or IPv6 address and not within a private or reserved range
app()->geoip->getIp() // Returns the detected client IP
```

### Default Location Data

[](#default-location-data)

When an IP is not detected it will be set to 127.0.0.1 which will ultimately throw an Exception. If you are not in production your record will default to the following data.

```
array (
    "ip"           => "232.223.11.11",
    "isoCode"      => "US",
    "country"      => "United States",
    "city"         => "New Haven",
    "state"        => "CT",
    "postal_code"  => "06510",
    "lat"          => 41.28,
    "lon"          => -72.88,
    "timezone"     => "America/New_York",
    "continent"    => "NA",
    "default"      => false
);
```

Change Log
----------

[](#change-log)

#### v2.0.0

[](#v200)

- Simplified namespace
- Added Facade support
- Added default location when in development
- Fixed bug where detected IP was always blank

###  Health Score

28

—

LowBetter than 51% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 83.9% 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 ~182 days

Recently: every ~150 days

Total

6

Last Release

3049d ago

Major Versions

v1.0.0 → v2.0.0-RC2016-08-20

PHP version history (2 changes)v1.0.0PHP &gt;=5.5.9

2.0.3PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5dbe36995907813d295422aceeac71aa288f0d12726778fe828f3393f2dec498?d=identicon)[SalmaAbdelhady](/maintainers/SalmaAbdelhady)

---

Top Contributors

[![cringerjs](https://avatars.githubusercontent.com/u/835448?v=4)](https://github.com/cringerjs "cringerjs (26 commits)")[![SalmaGhareeb](https://avatars.githubusercontent.com/u/6662253?v=4)](https://github.com/SalmaGhareeb "SalmaGhareeb (5 commits)")

---

Tags

phpgeoiplumencodenexus

### Embed Badge

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

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

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M315](/packages/laravel-ai)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

731189.9k16](/packages/tallstackui-tallstackui)[spatie/laravel-export

Create a static site bundle from a Laravel app

679153.2k7](/packages/spatie-laravel-export)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

199336.0k](/packages/fumeapp-modeltyper)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

265.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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