PHPackages                             sequelone/geonames - 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. [API Development](/categories/api)
4. /
5. sequelone/geonames

ActiveLibrary[API Development](/categories/api)

sequelone/geonames
==================

A Laravel (php) package that interfaces with the geolocation services on geonames.org.

v9.0.3(2y ago)13MITPHPPHP ^7.0 || ^8.0 || ^8.1 || ^8.2 || ^8.3

Since Mar 17Pushed 2y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (12)Versions (5)Used By (0)

geonames v9.x
=============

[](#geonames-v9x)

[![Latest Stable Version](https://camo.githubusercontent.com/4db32cda52046b052b37673f58698ad79582e803ffb714d8579f7c702a60d283/68747470733a2f2f706f7365722e707567782e6f72672f73657175656c6f6e652f67656f6e616d65732f76657273696f6e)](https://packagist.org/packages/sequelone/geonames) [![Total Downloads](https://camo.githubusercontent.com/bc04458293c491c30ffc17e0087aa053adac66eae420bf960cdf301998cb7118/68747470733a2f2f706f7365722e707567782e6f72672f73657175656c6f6e652f67656f6e616d65732f646f776e6c6f616473)](https://packagist.org/packages/sequelone/geonames) [![License](https://camo.githubusercontent.com/de83913a53b4ad50c5e2d56fe0a05b8dbf7749890491b1069e61caf5f9b20462/68747470733a2f2f706f7365722e707567782e6f72672f73657175656c6f6e652f67656f6e616d65732f6c6963656e7365)](https://packagist.org/packages/sequelone/geonames) [![GitHub issues](https://camo.githubusercontent.com/d7bece09d5f93132352cd96d73d0bf4c361cfaa7682b6d4b3e145193e39117d7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f73657175656c6f6e652f67656f6e616d6573)](https://github.com/sequelone/geonames/issues) [![GitHub forks](https://camo.githubusercontent.com/346f258eb971c61a2cd95263af5dfcd0ef132ddf9fd6195471f197fb71292887/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f73657175656c6f6e652f67656f6e616d6573)](https://github.com/sequelone/geonames/network) [![GitHub stars](https://camo.githubusercontent.com/6f94d3367875bf250b9a3986d89bafc83026f7a51a29a7c897c1be7a15241d19/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f73657175656c6f6e652f67656f6e616d6573)](https://github.com/sequelone/geonames/stargazers) [![Travis (.org)](https://camo.githubusercontent.com/133720dc4ce54574223336107f7a0204470880b66d68800f98085e049526729f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f73657175656c6f6e652f67656f6e616d6573)](https://camo.githubusercontent.com/133720dc4ce54574223336107f7a0204470880b66d68800f98085e049526729f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f73657175656c6f6e652f67656f6e616d6573)

A Laravel (php) package to interface with the geo-location services at geonames.org.

Major Version Jump
------------------

[](#major-version-jump)

I jumped several major versions to catch up with Larvel's major version number. Makes things a little clearer.

Notes
-----

[](#notes)

There is still a lot that needs to be done to make this package "complete". I've gotten it to a point where I can use it for my next project. As time allows, I will improve the documentation and testing that comes with this package. Thanks for understanding.

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

[](#installation)

```
composer require sequelone/geonames

```

And then add `geonames` provider to `providers` array in `app.php` config file:

```
SequelONE\Geonames\GeonamesServiceProvider::class,
```

After that, Run migrate command:

```
php artisan migrate

```

Settings
--------

[](#settings)

Add in .env

```
DB_PREFIX=

```

Add or edit in database driver `config/database.php`:

```
'prefix' => env('DB_PREFIX', ''),

```

and

```
'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
                PDO::MYSQL_ATTR_LOCAL_INFILE => true,
            ]) : [],

```

Do not forget to include local\_infile in MySQL:

```
SHOW GLOBAL VARIABLES LIKE 'local_infile';
SET GLOBAL local_infile = 'ON';
SHOW GLOBAL VARIABLES LIKE 'local_infile';

```

It should echo the following:

```
mysql> SHOW GLOBAL VARIABLES LIKE 'local_infile';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile  | OFF   |
+---------------+-------+
1 row in set (0.00 sec)

mysql> SET GLOBAL local_infile = 'ON';
Query OK, 0 rows affected (0.06 sec)

mysql> SHOW GLOBAL VARIABLES LIKE 'local_infile';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile  | ON    |
+---------------+-------+
1 row in set (0.00 sec)

mysql>

```

or if setting this in my.cnf:

```
[mysqld]
local_infile=ON

```

Want to install all of the geonames records for the US, Canada, and Mexico as well as pull in the feature codes definitions file in English?

```
php artisan geonames:install --country=US --country=CA --country=MX --language=en
```

Want to just install everything in the geonames database?

```
php artisan geonames:install
```

Maintenance
-----------

[](#maintenance)

Now that you have the geonames database up and running on your system, you need to keep it up-to-date.

I have an update script that you need to schedule in Laravel to run every day.

Some info on how to schedule Laravel artisan commands:

You can read this notice at:

`The "last modified" timestamp is in Central European Time. `

It looks like geonames updates their data around 3AM CET.

So if you schedule your system to run the geonames:update artisan command after 4AM CET, you should be good to go.

I like to keep my servers running on GMT. Keeps things consistent.

(Central European Time is 1 hour ahead of Greenwich Mean Time)

Assuming your servers are running on GMT, your update command would look like:

```
$schedule->command('geonames:update')->dailyAt('3:00');
```

The update artisan command will handle the updates and deletes to the geonames table.

By default, `GeonamesServiceProvider` will run it for you daily at `config('geonames.update_daily_at')`.

Gotchas
-------

[](#gotchas)

Are you getting something like: 1071 Specified key was too long

@see

Add this to your AppServiceProvider.php file:

```
Schema::defaultStringLength(191);
```

A quick word on indexes
-----------------------

[](#a-quick-word-on-indexes)

This library contains a bunch of migrations that contain a bunch of indexes. Now not everyone will need all of the indexes.

So when you install this library, run the migrations and delete the indexes that you don't need.

Also, Laravel doesn't let you specify a key length for indexes on varchar columns. There are two indexes suffering from this limit. Instead of creating indexes on those columns the "Laravel way", I send a raw/manual query to create the indexes with the proper lengths.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Total

4

Last Release

791d ago

PHP version history (2 changes)v9.0.0PHP ^7.0 || ^8.0 || ^8.1 || ^8.2

v9.0.1PHP ^7.0 || ^8.0 || ^8.1 || ^8.2 || ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/7eae8f6dc70ef8e7e86f9d76f7a2877fbcea11778deb1551f7eb39d7720d7752?d=identicon)[sequelone](/maintainers/sequelone)

---

Top Contributors

[![SequelONE](https://avatars.githubusercontent.com/u/14241611?v=4)](https://github.com/SequelONE "SequelONE (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sequelone-geonames/health.svg)

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

###  Alternatives

[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)[laravel/cashier-paddle

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

264778.4k3](/packages/laravel-cashier-paddle)[michaeldrennen/geonames

A Laravel (php) package that interfaces with the geolocation services on geonames.org.

9514.0k](/packages/michaeldrennen-geonames)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[masterro/laravel-mail-viewer

Easily view in browser outgoing emails.

6392.1k](/packages/masterro-laravel-mail-viewer)

PHPackages © 2026

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