PHPackages                             kslimani/laravel-geo - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. kslimani/laravel-geo

ActiveLibrary[Localization &amp; i18n](/categories/localization)

kslimani/laravel-geo
====================

Laravel Geo.

1.0.4(5y ago)1125.9k↓42.5%[1 issues](https://github.com/kslimani/laravel-geo/issues)MITPHPPHP &gt;=7.2CI failing

Since Sep 19Pushed 5y ago1 watchersCompare

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

READMEChangelogDependencies (10)Versions (23)Used By (0)

[![](https://github.com/kslimani/laravel-geo/workflows/Integration%20tests/badge.svg)](https://github.com/kslimani/laravel-geo/workflows/Integration%20tests/badge.svg)

Laravel Geo
===========

[](#laravel-geo)

A simple service provider to work with locales, countries and currencies.

It uses the following dependencies :

- [florianv/laravel-swap](https://github.com/florianv/laravel-swap)
- [kslimani/geo-list](https://github.com/kslimani/geo-list) (tiny version of umpirsky's projects)
- [maxmind/MaxMind-DB-Reader-php](https://github.com/maxmind/MaxMind-DB-Reader-php)
- [moneyphp/money](https://github.com/moneyphp/money)

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

[](#installation)

use Composer to add the package to your project's dependencies :

```
composer require kslimani/laravel-geo
```

Note: Swap uses [HTTPlug](http://httplug.io/) abstraction which may require additional dependencies. For example using Curl :

```
composer require php-http/curl-client nyholm/psr7 php-http/message
```

Optionally, adds the Geo facade in `config/app.php` :

```
'aliases' => [
    // ...
    'Geo' => Sk\Geo\Facades\Geo::class,
];
```

Publish the [configuration file](https://github.com/kslimani/laravel-geo/blob/master/config/geo.php) `config/geo.php` :

```
php artisan vendor:publish --provider="Sk\Geo\GeoServiceProvider" --tag="config"
```

Optionally, publish [Swap service provider configuration](https://github.com/florianv/laravel-swap/blob/master/doc/readme.md#configuration) file :

```
php artisan vendor:publish --provider="Swap\Laravel\SwapServiceProvider"
```

Quick usage
-----------

[](#quick-usage)

```
use Sk\Geo\Facades\Geo;

// Get country code from ip address (US)
$countryCode = Geo::location()->ipCountry('8.8.8.8');

// Get country name (United States)
$countryName = Geo::locale()->country($countryCode);

// Get country language code (en)
$languageCode = Geo::locale()->countryLanguage($countryCode);

// Get country language name (English)
$languageName = Geo::locale()->language($languageCode);

// Get country currency code (USD)
$currencyCode = Geo::locale()->countryCurrency($countryCode);

// Get country currency name (US Dollar)
$currencyName = Geo::locale()->currency($currencyCode);

// Make money amount
$fiveDollars = Geo::money()->make('500', $currencyCode);

// Get amount converted to Euro
$euroAmount = Geo::money()->convert($fiveDollars, 'EUR');

// Get formatted amount ("Intl" formatter)
$intlFormattedAmount = Geo::money()->format($euroAmount);

// Get formatted amount ("Decimal" formatter)
$decFormattedAmount = Geo::money()->formatDec($euroAmount);

// Parse "Decimal" formatted amount
$newEuroAmount = Geo::money()->parse($decFormattedAmount, 'EUR');

// Decompose money amount
$keyValueArray = Geo::money()->decompose($fiveDollars);
// [
//   "locale" => "en"
//   "subunit" => 2
//   "sign" => "+"
//   "unsigned_part" => "5"
//   "decimal_part" => "00"
//   "grouping_separator" => ","
//   "decimal_separator" => "."
//   "symbol" => "$"
// ]

// Get all countries (country code -> name associative array)
$countries = Geo::locale()->countries();

// Get all languages (language code -> name associative array)
$languages = Geo::locale()->languages();

// Get all currencies (currency code -> name associative array)
$currencies = Geo::locale()->currencies();

// All methods returning a name accept an optional locale (default is application locale)
Geo::locale()->country('US', 'es');      // 'Estados Unidos'
Geo::locale()->language('en', 'de')      // 'Englisch'
Geo::locale()->currency('USD', 'ru')     // 'Доллар США'
Geo::locale()->countries('zh')           // [ 'BT' => '不丹', 'TL' => '东帝汶', ... ]
Geo::money()->format($fiveDollars, 'fr') // '5,00 $US'
Geo::money()->decompose($amount, 'fr');  // [ 'locale' => 'fr', ... ]

// Get instances using app helper
$location =  app('geo.location');
$locale = app('geo.locale');
$money = app('geo.money');
```

Console commands
----------------

[](#console-commands)

This package also provides some Artisan console commands :

```
geo:exchange          Simple currency converter
geo:info              Display geo data for ip address
geo:list              Display countries with default language and currency
geo:maxmind           Display Maxmind DB countries with matched geo country name

```

Note: `geo:list` and `geo:maxmind` are mainly used for package development.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

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

Recently: every ~86 days

Total

22

Last Release

1988d ago

Major Versions

0.6.0 → 1.0.02020-02-14

PHP version history (4 changes)0.0.1PHP &gt;=5.6.4

0.2.0PHP &gt;=7.1.3

0.2.1PHP &gt;=7.0.0

0.6.0PHP &gt;=7.2

### Community

Maintainers

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

---

Top Contributors

[![kslimani](https://avatars.githubusercontent.com/u/1758996?v=4)](https://github.com/kslimani "kslimani (101 commits)")

---

Tags

countrycurrencygeolanguagelaravellocalemaxmindmoneylaravelcurrencylocalegeocountry

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/kslimani-laravel-geo/health.svg)

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

###  Alternatives

[codezero/laravel-localized-routes

A convenient way to set up, manage and use localized routes in a Laravel app.

544664.5k4](/packages/codezero-laravel-localized-routes)[codezero/laravel-localizer

Automatically detect and set an app locale that matches your visitor's preference.

50404.9k4](/packages/codezero-laravel-localizer)[devrabiul/laravel-geo-genius

Laravel GeoGenius — A powerful, intelligent toolkit for geo-location, timezone, and locale-based features in Laravel applications.

18212.3k1](/packages/devrabiul-laravel-geo-genius)[opgginc/codezero-laravel-localized-routes

A convenient way to set up, manage and use localized routes in a Laravel app.

29119.1k1](/packages/opgginc-codezero-laravel-localized-routes)[niels-numbers/laravel-localizer

Detects the user’s preferred language and redirects to the matching localized URL.

183.4k](/packages/niels-numbers-laravel-localizer)[tigrov/yii2-country

Country data for Yii2 using Intl extension and more.

151.1k](/packages/tigrov-yii2-country)

PHPackages © 2026

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