PHPackages                             yaroslawww/laravel-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. yaroslawww/laravel-geonames

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

yaroslawww/laravel-geonames
===========================

Import and manipulate geonames data in your project.

2.0.1(3y ago)226MITPHPPHP ^8.1

Since Dec 7Pushed 3y ago2 watchersCompare

[ Source](https://github.com/yaroslawww/laravel-geonames)[ Packagist](https://packagist.org/packages/yaroslawww/laravel-geonames)[ Docs](https://github.com/yaroslawww/laravel-geonames)[ RSS](/packages/yaroslawww-laravel-geonames/feed)WikiDiscussions master Synced 2d ago

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

Laravel geonames.
=================

[](#laravel-geonames)

[![Packagist License](https://camo.githubusercontent.com/8f0b1d081e0d1a698b4fc4b76079f30d68c38c0fc6ac6ca17d4435a0d9fe637c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7961726f736c617777772f6c61726176656c2d67656f6e616d65733f636f6c6f723d253233346463373166)](https://camo.githubusercontent.com/8f0b1d081e0d1a698b4fc4b76079f30d68c38c0fc6ac6ca17d4435a0d9fe637c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7961726f736c617777772f6c61726176656c2d67656f6e616d65733f636f6c6f723d253233346463373166)[![Packagist Version](https://camo.githubusercontent.com/908b80fea60a4b0c3d068dfaa37a5daa50c1bc21b813ac6a4470a0f0364a17a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7961726f736c617777772f6c61726176656c2d67656f6e616d6573)](https://packagist.org/packages/yaroslawww/laravel-geonames)[![Total Downloads](https://camo.githubusercontent.com/9a802ccfe299f229d34a8d5345c1994a9a12738202cb4d4147594d2415e54e43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7961726f736c617777772f6c61726176656c2d67656f6e616d6573)](https://packagist.org/packages/yaroslawww/laravel-geonames)[![Build Status](https://camo.githubusercontent.com/20ae503b14e2ef487150cc751f6e10168997352d065925dfe5e008dad1f4293e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7961726f736c617777772f6c61726176656c2d67656f6e616d65732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/yaroslawww/laravel-geonames/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/4359931b459a4ed7b6cacde5e0cd9e13d3ecddd8d14a90857e32da3127ac272e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7961726f736c617777772f6c61726176656c2d67656f6e616d65732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/yaroslawww/laravel-geonames/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d62f115a7304230085a489ff4fd586271a18aabbad1569d7b2bccc6b4b5e74af/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7961726f736c617777772f6c61726176656c2d67656f6e616d65732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/yaroslawww/laravel-geonames/?branch=master)

Import and manipulate geonames data in your project.

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

[](#installation)

Install the package via composer:

```
composer require yaroslawww/laravel-geonames
# or
composer require yaroslawww/laravel-geonames --dev
```

Optionally you can publish the config file with:

```
php artisan vendor:publish --provider="LaraGeoData\ServiceProvider" --tag="config"
```

Allow import local infile:

```
[
    'mysql_geo' => [
        // ....
        'options'    => [PDO::MYSQL_ATTR_LOCAL_INFILE=>true],
     ],
]

```

Usage
-----

[](#usage)

### Commands

[](#commands)

#### Manipulate dump files

[](#manipulate-dump-files)

Download dump files:

```
php artisan geonames:download GB.zip FR.zip --postal=GB.zip --postal=GB_full.csv.zip --postal=FR.zip --extract --force
```

Clear all downloaded files:

```
php artisan geonames:download:truncate
```

#### Make migrations

[](#make-migrations)

```
php artisan geonames:make:migration geonames
# or
php artisan geonames:make:migration geonames --suffix=gb

php artisan geonames:make:migration postalcodes --suffix=gb
php artisan geonames:make:migration admin_areas_view --suffix=gb --replaces=level:1
php artisan geonames:make:migration admin_areas_view --suffix=gb --replaces=level:2
php artisan geonames:make:migration admin_areas_view --suffix=gb --replaces=level:3
```

#### Import dump data to tables

[](#import-dump-data-to-tables)

```
php artisan geonames:import:file-to-db geonames
# or
php artisan geonames:import:file-to-db geonames --suffix=gb
# or
php artisan geonames:import:file-to-db geonames path/to/my/file.csv --suffix=gb

php artisan geonames:import:file-to-db postalcodes --suffix=gb
php artisan geonames:import:file-to-db postalcodes postal_codes/GB_full.txt --suffix=gb
```

### Models

[](#models)

#### Geocodes

[](#geocodes)

Initialise table:

```
$model = new Geoname();
# or
$model = Geoname::makeUsingSuffix('gb');
# or
# .env:  GEONAMES_DEFAULT_SUFFIX=gb
$model = new Geoname();

```

Use table:

```
Geoname::nearestInMiles(24.76778, 56.16306, 1.5)->orderByNearest()->get()
// or
$model = Geoname::makeUsingSuffix('gb');
$nearestLocation = $model->newQuery()->nearestInMiles(24.76778, 56.16306, 1.5)->orderByNearest()->firstOrFail();
echo $nearestLocation->distance;

```

Credits
-------

[](#credits)

- [![Think Studio](https://camo.githubusercontent.com/8e541bece07d503c85a126b5294865faa00e27371048772f566a0cce8c01fd3a/68747470733a2f2f7961726f736c617777772e6769746875622e696f2f696d616765732f73706f6e736f72732f7061636b616765732f6c6f676f2d7468696e6b2d73747564696f2e706e67)](https://think.studio/)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

3

Last Release

1338d ago

Major Versions

1.2.3 → 2.0.02022-09-12

PHP version history (2 changes)1.2.3PHP ^8.0

2.0.0PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![yaroslawww](https://avatars.githubusercontent.com/u/23663794?v=4)](https://github.com/yaroslawww "yaroslawww (35 commits)")

---

Tags

laravelgeonames

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[xefi/faker-php-laravel

Faker php integration with laravel

1915.1k](/packages/xefi-faker-php-laravel)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

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