PHPackages                             cslash/laravel-geoname - 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. cslash/laravel-geoname

ActiveLibrary

cslash/laravel-geoname
======================

Generate location labels like FR-WEST from IP addresses in Laravel.

1.0.0(1mo ago)01↑2900%MITPHPPHP ^8.2

Since Mar 27Pushed 1mo agoCompare

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

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

Laravel GeoName
===============

[](#laravel-geoname)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7f60e138c120c251dd72118048686a095955b392938daf8fbf311bf5d6794191/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63736c6173682f6c61726176656c2d67656f6e616d652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cslash/laravel-geoname)

Laravel GeoName is a lightweight package that generates location labels (e.g., `FR-WEST`, `US-CENTRAL`) from IP addresses or geographic coordinates. It's built on top of [stevebauman/location](https://github.com/stevebauman/location) to provide regional resolution.

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 10.0 or higher

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

[](#installation)

You can install the package via composer:

```
composer require cslash/laravel-geo-name
```

The package will automatically register its service provider and facade.

Optionally, you can publish the config file:

```
php artisan vendor:publish --tag="geoname-config"
```

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

The `GeoName` facade provides a simple interface to resolve location labels.

#### From Current Request

[](#from-current-request)

Automatically detect the user's IP address from the current request:

```
use Cslash\GeoName\Facades\GeoName;

$label = GeoName::fromRequest();
// Returns something like "FR-NORTH" or "US-WEST"
```

#### From a Specific IP

[](#from-a-specific-ip)

```
use Cslash\GeoName\Facades\GeoName;

$label = GeoName::fromIp('8.8.8.8');
```

#### From GeoContext

[](#from-geocontext)

If you already have coordinates or region data, you can use a `GeoContext` object:

```
use Cslash\GeoName\Data\GeoContext;
use Cslash\GeoName\Facades\GeoName;

$context = new GeoContext(
    countryCode: 'FR',
    regionName: 'Brittany',
    regionCode: 'BRE',
    latitude: 48.1173,
    longitude: -1.6778
);

$label = GeoName::fromContext($context); // "FR-WEST"
```

Configuration
-------------

[](#configuration)

The `config/geoname.php` file allows you to customize fallbacks and region mappings:

```
return [
    'fallback' => 'XX-UNKNOWN', // Returned when IP location cannot be determined
    'unknown_zone' => 'UNKNOWN', // Returned when coordinates are missing for generic resolution

    'countries' => [
        'FR' => [
            'thresholds' => [47.5, 44.5, -0.5, 4.5], // north, south, west, east
            'region_map' => [
                'BRE' => 'WEST',
                'NOR' => 'WEST',
                // ...
            ],
        ],
    ],
];
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

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

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance90

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

Unknown

Total

1

Last Release

46d ago

### Community

Maintainers

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

---

Top Contributors

[![cscognamiglio](https://avatars.githubusercontent.com/u/11227537?v=4)](https://github.com/cscognamiglio "cscognamiglio (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cslash-laravel-geoname/health.svg)

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

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

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

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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