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

ActiveLibrary

mannysoft/geoip
===============

Supports the two main GeoIP services (infoDB and Maxmind).

0.2.2(10y ago)08BSD 2-ClausePHPPHP &gt;=5.3.0

Since Dec 12Pushed 10y ago1 watchersCompare

[ Source](https://github.com/mannysoft/laravel-geoip)[ Packagist](https://packagist.org/packages/mannysoft/geoip)[ RSS](/packages/mannysoft-geoip/feed)WikiDiscussions master Synced 1mo ago

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

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

[](#geoip-for-laravel-5)

[![Latest Stable Version](https://camo.githubusercontent.com/b4c14a8e89fbb6b35a4ec178cffcdb93c48093b3e4d9cae15b1f1ef93baa9566/68747470733a2f2f706f7365722e707567782e6f72672f746f72616e6e2f67656f69702f762f737461626c652e706e67)](https://packagist.org/packages/torann/geoip) [![Total Downloads](https://camo.githubusercontent.com/b8537b5c4fa2664d4f542c6a974277ca0b9db5666d854a1346959c541f8b29d4/68747470733a2f2f706f7365722e707567782e6f72672f746f72616e6e2f67656f69702f646f776e6c6f6164732e706e67)](https://packagist.org/packages/torann/geoip)

Determine the geographical location of website visitors based on their IP addresses. [Homepage](http://lyften.com/projects/laravel-geoip/)

---

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

[](#installation)

- [GeoIP for Laravel 5 on Packagist](https://packagist.org/packages/torann/geoip)
- [GeoIP for Laravel 5 on GitHub](https://github.com/Torann/laravel-geoip)
- [Laravel 4 Installation](https://github.com/Torann/laravel-geoip/tree/0.1.1)

To get the latest version of GeoIP simply require it in your `composer.json` file.

```
"torann/geoip": "0.2.*@dev"

```

You'll then need to run `composer install` to download it and have the autoloader updated.

Once GeoIP is installed you need to register the service provider with the application. Open up `config/app.php` and find the `providers` key.

```
'providers' => array(

    'Torann\GeoIP\GeoIPServiceProvider',

)
```

GeoIP also ships with a facade which provides the static syntax for creating collections. You can register the facade in the `aliases` key of your `config/app.php` file.

```
'aliases' => array(

    'GeoIP' => 'Torann\GeoIP\GeoIPFacade',

)
```

### Publish the configurations

[](#publish-the-configurations)

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

```
$ php artisan vendor:publish

```

A configuration file will be publish to `config/geoip.php`

### Update max mind cities database

[](#update-max-mind-cities-database)

```
$ php artisan geoip:update

```

**Database Service**: To use the database version of [MaxMind](http://www.maxmind.com) services download the `GeoLite2-City.mmdb` from  and extract it to `storage/app/geoip.mmdb`. And that's it.

Usage
-----

[](#usage)

Get the location data for a website visitor:

```
$location = GeoIP::getLocation();
```

> When an IP is not given the `$_SERVER["REMOTE_ADDR"]` is used.

Getting the location data for a given IP:

```
$location = GeoIP::getLocation('232.223.11.11');
```

### Example Data

[](#example-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
);
```

#### Default Location

[](#default-location)

In the case that a location is not found the fallback location will be returned with the `default` parameter set to `true`. To set your own default change it in the configurations `config/geoip.php`

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

[](#change-log)

#### v0.2.1

[](#v021)

- Add database\_path to config
- Add update\_url to config
- Add GeoIP database update command "php artisan geoip:update"
- Add some test
- Format code

#### v0.2.0

[](#v020)

- Update to Laravel 5
- Support IPv6
- Log address not found exceptions
- Supports a custom default location

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.8% 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 ~141 days

Total

5

Last Release

3967d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e7052870acdc2ec859177432893616bfdc226fa96009f1773269140ca9a5aa1?d=identicon)[mannysoft](/maintainers/mannysoft)

---

Top Contributors

[![Torann](https://avatars.githubusercontent.com/u/1406755?v=4)](https://github.com/Torann "Torann (21 commits)")[![dotpack](https://avatars.githubusercontent.com/u/1175814?v=4)](https://github.com/dotpack "dotpack (10 commits)")[![kyranb](https://avatars.githubusercontent.com/u/5426926?v=4)](https://github.com/kyranb "kyranb (3 commits)")[![LukeT](https://avatars.githubusercontent.com/u/2203091?v=4)](https://github.com/LukeT "LukeT (2 commits)")[![mannysoft](https://avatars.githubusercontent.com/u/774913?v=4)](https://github.com/mannysoft "mannysoft (1 commits)")

---

Tags

laravelgeoipgeolocationlaravel 5location

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[torann/geoip

Support for multiple Geographical Location services.

2.2k14.2M76](/packages/torann-geoip)[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[prologue/alerts

Prologue Alerts is a package that handles global site messages.

3486.1M30](/packages/prologue-alerts)[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)

PHPackages © 2026

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