PHPackages                             melsaka/world-countries - 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. melsaka/world-countries

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

melsaka/world-countries
=======================

A Laravel package that allows you to easily add countries, states and cities to your Laravel applications.

v0.1.0(2y ago)041[1 issues](https://github.com/melsaka/world-countries/issues)MITPHPPHP ^8.1

Since Oct 31Pushed 2y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

World Countries
===============

[](#world-countries)

World Countries, is a Laravel package that provides an easy way to retrieve a list of countries with their respective states and cities. This can be useful for various applications, such as creating location-based forms, populating dropdowns, or any other scenario where you need to work with geographical data.

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

[](#installation)

Add the package to your Laravel app via Composer:

```
composer require melsaka/world-countries
```

Register the package's service provider in config/app.php.

```
'providers' => [
    ...
    Melsaka\WorldCountries\WorldCountriesServiceProvider::class,
    ...
];
```

Usage
-----

[](#usage)

After installing the package, you can start using it in your Laravel application.

### Countries

[](#countries)

You can access all countries data using the `get()` method:

```
use Melsaka\WorldCountries\Country;

$countries = new Country();

// returns a laravel collection of all supported countries.
$allCountries = $countries->get();

// returns the data of a specifc country as an array
$egypt = $countries->get('eg');
```

Country Data Example:

```
array:24 [▼
  "id" => 65
  "name" => "Egypt"
  "name_ar" => "مصر"
  "iso3" => "EGY"
  "iso2" => "EG"
  "numeric_code" => "818"
  "phone_code" => "20"
  "capital" => "Cairo"
  "currency" => "EGP"
  "currency_name" => "Egyptian pound"
  "currency_symbol" => "ج.م"
  "tld" => ".eg"
  "native" => "مصر‎"
  "region" => "Africa"
  "region_id" => "1"
  "subregion" => "Northern Africa"
  "subregion_id" => "1"
  "nationality" => "Egyptian"
  "timezones" => array:1 [▼
    0 => array:5 [▼
      "zoneName" => "Africa/Cairo"
      "gmtOffset" => 7200
      "gmtOffsetName" => "UTC+02:00"
      "abbreviation" => "EET"
      "tzName" => "Eastern European Time"
    ]
  ]
  "translations" => array:13 [▼
    "kr" => "이집트"
    "pt-BR" => "Egito"
    "pt" => "Egipto"
    "nl" => "Egypte"
    "hr" => "Egipat"
    "fa" => "مصر"
    "de" => "Ägypten"
    "es" => "Egipto"
    "fr" => "Égypte"
    "ja" => "エジプト"
    "it" => "Egitto"
    "cn" => "埃及"
    "tr" => "Mısır"
  ]
  "latitude" => "27.00000000"
  "longitude" => "30.00000000"
  "emoji" => "🇪🇬"
  "emojiU" => "U+1F1EA U+1F1EC"
]
```

### States

[](#states)

To get the country states data:

```
// returns a laravel collection of egyptian states.
$egyptianStates = Country::states($egypt);

// returns the data of a specifc state in egypt as an array
$alexandria = Country::states($egypt, 'ALX');
```

You can also access each country states data by calling the `get()` method form `State` object:

```
use Melsaka\WorldCountries\State;

$states = new State($egypt);
// or
$states = new State('EG');

// returns a laravel collection of egyptian states.
$egyptianStates = $states->get();

// returns the data of a specifc state in egypt as an array
$alexandria = $states->get('ALX');
```

State Data Example:

```
array:10 [▼
  "id" => 3235
  "name" => "Alexandria"
  "name_ar" => "Alexandria"
  "country_id" => 65
  "country_code" => "EG"
  "country_name" => "Egypt"
  "state_code" => "ALX"
  "type" => null
  "latitude" => "30.87605680"
  "longitude" => "29.74260400"
]
```

### Cities

[](#cities)

To get the country cities data:

```
// returns a laravel collection of egyptian cities.
$egyptianCities = Country::cities($egypt);

// returns a laravel collection of egyptian cities that belongs to specifc state in egypt
$alexandriaCities = Country::cities($egypt, 'ALX');
// or
$alexandriaCities = Country::cities($egypt, $alexandria);
```

You can also access each country cities data by calling the `get()` method from `City` object:

```
use Melsaka\WorldCountries\City;

$cities = new City($egypt);
// or
$cities = new City('EG');

// returns a laravel collection of egyptian cities.
$egyptianCities = $cities->get();

// returns a laravel collection of egyptian cities that belongs to specifc state in egypt
$alexandriaCities = $cities->get('ALX');
```

City Data Example:

```
array:9 [▼
  "id" => 1140594
  "name" => "Abees"
  "name_ar" => "Abees"
  "state_id" => 3235
  "state_code" => "ALX"
  "state_name" => "Alexandria"
  "country_id" => 65
  "country_code" => "EG"
  "country_name" => "Egypt"
]
```

License
-------

[](#license)

This package is released under the MIT license (MIT).

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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

923d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6c7cf52b7cdfb096062f2e3862d4d8f45f9b8b5af8bc8d06e5ed74dcb5316682?d=identicon)[melsaka](/maintainers/melsaka)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/melsaka-world-countries/health.svg)

```
[![Health](https://phpackages.com/badges/melsaka-world-countries/health.svg)](https://phpackages.com/packages/melsaka-world-countries)
```

###  Alternatives

[tightenco/ziggy

Use your Laravel named routes in JavaScript.

4.3k41.6M267](/packages/tightenco-ziggy)[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)[nickurt/laravel-akismet

Akismet for Laravel 11.x/12.x/13.x

97139.6k2](/packages/nickurt-laravel-akismet)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)

PHPackages © 2026

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