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

ActiveLaravel-package[Localization &amp; i18n](/categories/localization)

emiliopedrollo/world
====================

Laravel countries, states, cities and currencies

1.1.7(4y ago)011MITPHPPHP &gt;=7.4

Since Jan 22Pushed 4y agoCompare

[ Source](https://github.com/emiliopedrollo/world)[ Packagist](https://packagist.org/packages/emiliopedrollo/world)[ Docs](https://github.com/nnjeim/world.git)[ RSS](/packages/emiliopedrollo-world/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (9)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 nnjeim/world

php artisan vendor:publish --tag=world

php artisan migrate

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

```

### Upgrading to v1.1.6?

[](#upgrading-to-v116)

- Re-publish the package assets by issuing the command `php artisan vendor:publish --tag=world --force`
- If needed, customize the table names and enable or disabled the optional database fields in the `world.php` config file.

### 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\_id\]=182&amp;fields=cities](https://laravel-world.com/api/states?filters%5Bcountry_id%5D=182&fields=cities)

### Usage

[](#usage)

#### List all the countries.

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

Use the World facade

```
use Nnjeim\World\World;

$action =  World::countries();

if ($action->success) {

	$countries = $action->data;
}

response
{
	"success": true,
	"message": "countries",
	"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 Nnjeim\World\World;

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

if ($action->success) {

	$countries = $action->data;
}

response
{
	"success": true,
	"message": "countries",
	"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 Nnjeim\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_id]=182

```

### 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.

#### 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.

#### 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.

#### 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.

#### 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.

#### Languages action

[](#languages-action)

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

### 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 filtersExample/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 filtersExample/api/states?fields=country,cities&amp;filters\[country\_id\]=182responsesuccess, message, data#### Cities

[](#cities)

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

[](#timezones)

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

[](#currencies)

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

[](#languages)

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

[](#localization)

The available locales are ar, bn, br, de, en, es, fr, ja, kr, pl, pt, ro, ru 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)

### 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

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 79.6% 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 ~10 days

Total

8

Last Release

1500d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/442cd299d4ec476168c0d4274a4f2f784573c61d27a0a955067bc05233bbcec5?d=identicon)[emiliopedrollo](/maintainers/emiliopedrollo)

---

Top Contributors

[![nnjeim](https://avatars.githubusercontent.com/u/78922079?v=4)](https://github.com/nnjeim "nnjeim (43 commits)")[![emiliopedrollo](https://avatars.githubusercontent.com/u/6577541?v=4)](https://github.com/emiliopedrollo "emiliopedrollo (4 commits)")[![Ivanshamir](https://avatars.githubusercontent.com/u/29983451?v=4)](https://github.com/Ivanshamir "Ivanshamir (3 commits)")[![gdevlugt](https://avatars.githubusercontent.com/u/1107080?v=4)](https://github.com/gdevlugt "gdevlugt (2 commits)")[![cloudchristoph](https://avatars.githubusercontent.com/u/204027?v=4)](https://github.com/cloudchristoph "cloudchristoph (1 commits)")[![parth391](https://avatars.githubusercontent.com/u/4966579?v=4)](https://github.com/parth391 "parth391 (1 commits)")

---

Tags

laravellumencountriesstatescurrenciestimezonescities

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[nnjeim/world

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

970361.2k3](/packages/nnjeim-world)[pragmarx/countries

PHP Countries and Currencies

1.9k3.3M18](/packages/pragmarx-countries)[pragmarx/countries-laravel

Countries for Laravel

1471.1M2](/packages/pragmarx-countries-laravel)[pharaonic/laravel-locations

Laravel - Countries\[States/Cities, Currency, Phone Code, Languages, Capital\] &amp; Continents &amp; Timezones.

102.4k1](/packages/pharaonic-laravel-locations)

PHPackages © 2026

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