PHPackages                             moharrum/laravel-geoip-world-cities - 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. moharrum/laravel-geoip-world-cities

ActiveLibrary

moharrum/laravel-geoip-world-cities
===================================

Laravel GeoIP World Cities provides MaxMind Free World Cities Database for laravel applications.

2.3.4(6y ago)28.0k5MITPHPPHP ~5.5|~7.0CI failing

Since Mar 19Pushed 6y ago1 watchersCompare

[ Source](https://github.com/kmuharam/laravel-geoip-world-cities)[ Packagist](https://packagist.org/packages/moharrum/laravel-geoip-world-cities)[ Docs](https://github.com/moharrum/laravel-geoip-world-cities)[ RSS](/packages/moharrum-laravel-geoip-world-cities/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (11)Used By (0)

laravel-geoip-world-cities (Laravel 5)
======================================

[](#laravel-geoip-world-cities-laravel-5)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8caa2adfc36fbc6b757102f8cc1087bd15763cc8a8d73376cedad54c356a7b01/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f68617272756d2f6c61726176656c2d67656f69702d776f726c642d6369746965732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/moharrum/laravel-geoip-world-cities)[![Latest Unstable Version](https://camo.githubusercontent.com/92a814b7d96f0b74dc0b157912893a21e5be251a35f4e25a6e608ee644d309a7/68747470733a2f2f706f7365722e707567782e6f72672f6d6f68617272756d2f6c61726176656c2d67656f69702d776f726c642d6369746965732f762f756e737461626c65)](https://packagist.org/packages/moharrum/laravel-geoip-world-cities)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/moharrum/laravel-geoip-world-cities/blob/master/LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/74913196040275cb677feadb0dc1a7ba57453eb20a7247c038b8a42c73d53ee0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f68617272756d2f6c61726176656c2d67656f69702d776f726c642d6369746965732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/moharrum/laravel-geoip-world-cities)

Laravel GeoIP World Cities is package that provides [MaxMind](https://www.maxmind.com/en/free-world-cities-database) Free World Cities Database support for laravel applications.

Contents
--------

[](#contents)

- [Introduction](#introduction)
- [Before installing](#before-installing)
- [Installation](#installation)
- [Table structure](#table-structure)
- [Example](#example)
- [Troubleshooting](#troubleshooting)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

Introduction
------------

[](#introduction)

Includes city, region, country, latitude and longitude. This database doesn't contain any IP addresses. It's simply a listing of all the cities in the world.

This package simply loads the data provided in `worldcitiespop.txt.gz` file by [MaxMind](https://www.maxmind.com/) into a database and provides a `City` model to query the table.

Before installing
-----------------

[](#before-installing)

If you are looking for the Laravel 4 version, take a look [Branch 1.0](https://github.com/moharrum/laravel-geoip-world-cities/tree/1.0).

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

[](#installation)

**Note: This package is a bit large, ~40MB, installing and seeding the data could take a while.**

Add `moharrum/laravel-geoip-world-cities` to `composer.json`:

```
"moharrum/laravel-geoip-world-cities": "2.*"

```

for the last stable version, or

```
"moharrum/laravel-geoip-world-cities": "dev-master"

```

for the latest version.

Run `composer update` to pull down laravel-geoip-world-cities.

Edit `config/app.php` and add the `provider` (ignore this step if you have package discovery enabled)

```
    'providers' => [
        Moharrum\LaravelGeoIPWorldCities\LaravelGeoIPWorldCitiesServiceProvider::class,
    ]
```

Optionally add the alias.

```
    'aliases' => [
        'Cities' => Moharrum\LaravelGeoIPWorldCities\Facade::class,
    ]
```

Configure MySQL and PDO, insert the following code in `config/database.php`:

```
    'mysql' => [
        'options'   => [PDO::MYSQL_ATTR_LOCAL_INFILE => true],
    ],
```

Publishing the configuration file, this is where you can change the default table name

```
php artisan vendor:publish

```

Publishing the migration and seeder files

```
php artisan cities:migration
php artisan cities:seeder

```

To make sure the data is seeded insert the following code in `seeds/DatabaseSeeder.php`

```
    // Seeding the cities
    $this->call(CitiesTableSeeder::class);
    $this->command->info('Seeded the cities table ...');
```

You may now run:

```
php artisan migrate --seed

```

After running this command the filled cities table will be available

Table structure
---------------

[](#table-structure)

idcountrycitycity\_asciiregionpopulationlatitudelongitude................2685662sdKhartoumkhartoum29197478015.58805632.534167................Example
-------

[](#example)

The package provides a `City` model which can be used to query the data

```
    \Moharrum\LaravelGeoIPWorldCities\City::whereCity('Khartoum')->first();
```

Troubleshooting
---------------

[](#troubleshooting)

If you are getting a `ReflectionException` when trying to seed

```
    [ReflectionException]
    Class CitiesTableSeeder does not exist
```

run:

```
    composer dump-autoload
```

and try again.

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Credits
-------

[](#credits)

- [MaxMind](https://www.maxmind.com)
- [Khalid Moharrum](https://github.com/moharrum)
- [MCMatters](https://github.com/MCMatters)

License
-------

[](#license)

MaxMind WorldCities [License](http://download.maxmind.com/download/geoip/database/LICENSE_WC.txt).

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

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 98.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 ~165 days

Recently: every ~289 days

Total

10

Last Release

2220d ago

Major Versions

1.0 → 2.12016-05-03

1.1 → 2.22017-02-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/95fb9088780e68bba1f41cd873d38a594c91fc38168f0e32be7f0b46ed9a08cd?d=identicon)[moharrum](/maintainers/moharrum)

---

Top Contributors

[![kmuharam](https://avatars.githubusercontent.com/u/15950349?v=4)](https://github.com/kmuharam "kmuharam (90 commits)")[![MCMatters](https://avatars.githubusercontent.com/u/3148853?v=4)](https://github.com/MCMatters "MCMatters (1 commits)")

---

Tags

cititesgeoiplaravelmaxmindmaxmind-geoipworldcitiespoplaravelgeoipmaxmindMoharrumlaravel-geoip-world-citiesworldcitiespopworld-citiesmaxmind-free-world-cities-database

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/moharrum-laravel-geoip-world-cities/health.svg)

```
[![Health](https://phpackages.com/badges/moharrum-laravel-geoip-world-cities/health.svg)](https://phpackages.com/packages/moharrum-laravel-geoip-world-cities)
```

###  Alternatives

[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[torann/geoip

Support for multiple Geographical Location services.

2.2k14.2M76](/packages/torann-geoip)[nnjeim/world

Laravel countries, states, cities, currencies, languages and IP geolocation

970361.2k3](/packages/nnjeim-world)[adrianorosa/laravel-geolocation

Laravel Geo Location package to get details for a given IP Address

6593.3k1](/packages/adrianorosa-laravel-geolocation)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[moharrum/laravel-adminer

Adminer database management tool for your Laravel application.

451.0k](/packages/moharrum-laravel-adminer)

PHPackages © 2026

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