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

ActiveLaravel-package[Utility &amp; Helpers](/categories/utility)

eka/world
=========

Laravel countries, states, cities and currencies. Fork from Eka/world

v1.0(2y ago)04MITPHPPHP &gt;=7.4

Since Dec 16Pushed 2y ago1 watchersCompare

[ Source](https://github.com/eka-m/world)[ Packagist](https://packagist.org/packages/eka/world)[ Docs](https://github.com/eka/world.git)[ RSS](/packages/eka-world/feed)WikiDiscussions main Synced yesterday

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

[![Laravel world](./logo.jpg)](./logo.jpg)

The World is a Laravel package which provides a list of the countries, states, cities, timezones, currencies and languages.

It can be consumed with the World Facade or the defined Api routes.

### Installation

[](#installation)

```
composer require eka/world

php artisan vendor:publish --tag=world

php artisan migrate

php artisan db:seed --class=WorldSeeder (requires ~15min)

```

### What's new in v1.1.28?

[](#whats-new-in-v1128)

- Increase of the state\_code table name length to 5 characters to avoid a potential bug when seeding a new database.

### Changelog

[](#changelog)

Please read [CHANGELOG](CHANGELOG.md) for more information of what was changed recently.

### Contributing

[](#contributing)

Please read [CONTRIBUTING](CONTRIBUTING.md) for more details.

### Demo

[](#demo)

Please feel free to query

Examples

[https://laravel-world.com/api/states?filters\[country\_code\]=RO&amp;fields=cities](https://laravel-world.com/api/states?filters%5Bcountry_code%5D=RO&fields=cities)

### Usage

[](#usage)

#### List all the countries.

[](#list-all-the-countries)

Use the World facade

```
use eka\World\World;

$action =  World::countries();

if ($action->success) {
  $countries = $action->data;
}

response (object)
{
  "success": true,
  "data": [
    {
      "id": 1,
      "name": "Afghanistan"
    },
    {
      "id": 2,
      "name": "Åland Islands"
    },
    .
    .
    .
  ],
}

```

Use the Api countries endpoint

```
https://myDomain.local/api/countries

```

#### Fetch a country with its states and cities.

[](#fetch-a-country-with-its-states-and-cities)

Use the World facade

```
use eka\World\World;

$action =  World::countries([
	'fields' => 'states,cities',
	'filters' => [
		'iso2' => 'FR',
	]
]);

if ($action->success) {

	$countries = $action->data;
}

response (object)
{
  "success": true,
  "data": [
    "id": 77,
    "name": "France",
    "states": [
        {
          "id": 1271,
          "name": "Alo"
        },
        {
          "id": 1272,
          "name": "Alsace"
        },
        .
        .
        .
    ],
    "cities": [
        {
          "id": 25148,
          "name": "Abondance"
        },
        {
          "id": 25149,
          "name": "Abrest"
        },
        .
        .
        .
      ]
    ],
}

```

Use the Api countries endpoint

```
https://myDomain.local/api/countries?fields=states,cities&filters[iso2]=FR

```

#### List all the cities by country id.

[](#list-all-the-cities-by-country-id)

```
use eka\World\WorldHelper;

protected $world;

public function __construct(WorldHelper $world) {

	$this->world = $world;
}

$action = $this->world->cities([
	'filters' => [
		'country_id' => 182,
	],
]);

if ($action->success) {

	$cities = $action->data;
}

```

Use the Api cities endpoint

```
https://myDomain.local/api/cities?filters[country_code]=RO

```

### Available actions

[](#available-actions)

NameDescriptioncountrieslists all the world countriesstateslists all the statescitieslists all the citiestimezoneslists all the timezonescurrencieslists all the currencieslanguageslists all the languagesAn action response is formed as below:

- success (boolean)
- message (string)
- data (instance of Illuminate\\Support\\Collection)
- errors (array)

#### Countries action

[](#countries-action)

- fields\*: comma seperated string(countries table fields in addition to states, cities, currency and timezones).
- filters\*: array of keys(countries table fields) and their corresponding values.
- search\*: string.

#### States action

[](#states-action)

- fields\*: comma seperated string(states table fields in addition to country and states).
- filters\*: array of keys(states table fields) and their corresponding values.
- search\*: string.

#### Cities action

[](#cities-action)

- fields\*: comma seperated string(cities table fields in addition to country and state).
- filters\*: array of keys(cities table fields) and their corresponding values.
- search\*: string.

#### Timezones action

[](#timezones-action)

- fields\*: comma seperated string(timezones table fields in addition to country).
- filters\*: array of keys(timezones table fields) and their corresponding values.
- search\*: string.

#### Currencies action

[](#currencies-action)

- fields\*: comma seperated string(currencies table fields in addition to country).
- filters\*: array of keys(currencies table fields) and their corresponding values.
- search\*: string.

#### Languages action

[](#languages-action)

- fields\*: comma seperated string(languages table fields).
- filters\*: array of keys(languages table fields) and their corresponding values.
- search\*: string.

### Available Api routes

[](#available-api-routes)

All routes can be prefixed by any string. Ex admin, api, api ...

#### Countries

[](#countries)

MethodGETRoute/{prefix}/countriesParameters\*comma seperated fields(countries table fields in addition to states, cities, currency and timezones), array filters, string searchExample/api/countries?fields=iso2,cities&amp;filters\[phone\_code\]=44responsesuccess, message, data#### States

[](#states)

MethodGETRoute/{prefix}/statesParameters\*comma seperated fields(states table fields in addition to country and cities), array filters, string searchExample/api/states?fields=country,cities&amp;filters\[country\_code\]=ROresponsesuccess, message, data#### Cities

[](#cities)

MethodGETRoute/{prefix}/citiesParameters\*comma seperated fields(states table fields in addition to country and state), array filters, string searchExample/api/cities?fields=country,state&amp;filters\[country\_code\]=ROresponsesuccess, message, data#### Timezones

[](#timezones)

MethodGETRoute/{prefix}/timezonesParameters\*comma seperated fields(states table fields in addition to the country), array filters, string searchExample/api/timezones?fields=country&amp;filters\[country\_code\]=ROresponsesuccess, message, data#### Currencies

[](#currencies)

MethodGETRoute/{prefix}/currenciesParameters\*comma seperated fields(states table fields in addition to the country), array filters, string searchExample/api/timezones?fields=country&amp;filters\[country\_code\]=ROresponsesuccess, message, data#### Languages

[](#languages)

MethodGETRoute/{prefix}/languagesParameters\*comma seperated fields, string searchExample/api/languages?fields=dirresponsesuccess, message, data### Localization

[](#localization)

The available locales are ar, bn, br, de, en, es, fr, it, ja, kr, nl, pl, pt, ro, ru, tr and zh.
The default locale is en.
Include in the request header

```
accept-language=locale

```

Alternativley, you can use specific locale with the `World` Facade `setLocale('locale')` helper method. Example:

```
World::setLocale('zh')->countries();

```

### Schema

[](#schema)

[![](./schema.jpg)](./schema.jpg)

### Configuration

[](#configuration)

The configuration of the world package is in the world.php config file.
If you are upgrading from a previous version, you should consider re-publishing the file by issuing:

```
php artisan vendor:publish --tag=world --force

```

### Countries restrictitions

[](#countries-restrictitions)

Countries can be restricted while seeding the database either by adding the iso2 country codes in the allowed\_countries or dissallowed\_countries array lists.

#### Supported Locales

[](#supported-locales)

A list of the accepted locales which relate to the localized lang files.

#### Modules enablement

[](#modules-enablement)

The states, cities, timezones, currencies and languages modules can be optionally disabled.
Please note that the cities module depends on the states module.

#### Routes

[](#routes)

If you don't wish to use the packages as an api service, you can disable all the routes by assigning false to routes.

#### Migrations

[](#migrations)

It offers the ability to enable or disable the database fields.
When changing this configuration the database should be dropped and the seeder should be re-run.

### Testing

[](#testing)

Requirements

- The database is seeded.
- The database connection is defined in the .env file.

Browse to the package root folder and run:

```
composer install //installs the package dev dependencies
composer test
```

`* optional`

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

930d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b41f71aa6d1af0c5e61cd22e7a739759b294bbf37d86e516ecbc98a83d7648f5?d=identicon)[eka](/maintainers/eka)

---

Top Contributors

[![eka-m](https://avatars.githubusercontent.com/u/12056945?v=4)](https://github.com/eka-m "eka-m (7 commits)")

---

Tags

laravellumencountriesstatescurrenciestimezonescities

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[pragmarx/countries

PHP Countries and Currencies

1.9k3.4M24](/packages/pragmarx-countries)[nnjeim/world

Laravel countries, states, cities, currencies, languages and IP geolocation

978475.9k8](/packages/nnjeim-world)[pragmarx/countries-laravel

Countries for Laravel

1491.1M2](/packages/pragmarx-countries-laravel)[dipeshsukhia/laravel-country-state-city-data

Country State City Data Provider

8231.5k1](/packages/dipeshsukhia-laravel-country-state-city-data)[juanparati/iso-codes

A PHP library that provides ISO codes, currencies, languages, timezones and additional geopolitical information

17174.9k](/packages/juanparati-iso-codes)[usamamuneerchaudhary/country-city-state

Country City State Data Provider for Laravel 12+

242.7k](/packages/usamamuneerchaudhary-country-city-state)

PHPackages © 2026

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