PHPackages                             omisai/php-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. omisai/php-countries

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

omisai/php-countries
====================

PHP package to provide countries data

v1.4.0(3mo ago)225.2k↑39.6%1MITPHPPHP ^8.1CI passing

Since Mar 27Pushed 3mo agoCompare

[ Source](https://github.com/omisai-tech/php-countries)[ Packagist](https://packagist.org/packages/omisai/php-countries)[ Docs](https://github.com/omisai-tech/php-countries)[ RSS](/packages/omisai-php-countries/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (9)Used By (1)

[![License](https://camo.githubusercontent.com/ceb4fdc63136bdd099520bc8805f24002fd4ea06eec14542b2c029d9378952d3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f6d697361692f7068702d636f756e74726965733f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/omisai/omisai/php-countries)[![Latest Stable Version](https://camo.githubusercontent.com/dece6db47752f5665305613202377b666af321871502157c84d7e245b68aeb1d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6d697361692f7068702d636f756e74726965733f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/omisai/php-countries)[![PHP Version Require](https://camo.githubusercontent.com/bc3174a0145cb2d0f0479e3e4b056423599679300bdda57c769ebb4c6bd76e3c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6f6d697361692f7068702d636f756e74726965732f7068703f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/omisai/php-countries)[![Test](https://github.com/omisai-tech/php-countries/actions/workflows/test.yml/badge.svg)](https://github.com/omisai-tech/php-countries/actions/workflows/test.yml)

PHP Countries Package
=====================

[](#php-countries-package)

The PHP Countries Package provides a convenient and object-oriented approach to working with country data. Designed to integrate country information into any PHP applications with ease. This package offers easy access to country names, ISO 3166-1 alpha-2 code, ISO 3166-1 alpha-3 code, ISO 3166-1 numeric code, FIPS code, phone dial, country's capital city, continent code.

Features
--------

[](#features)

- Easy retrieval of country names and codes, capital city and/or continent.
- Object-Oriented Programming (OOP) approach for better data management and integration.
- Lightweight and simple to integrate into any PHP project. (8.1+)
- Currently supporting English, Hungarian, German, Spanish, Italian, French and Portuguese languages.
- Future support for multiple locales, making it versatile for international applications.

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

[](#installation)

The PHP Countries Package can be easily installed via Composer.

```
composer require omisai/php-countries
```

Usage
-----

[](#usage)

After installing the package, you can begin to work with any country data. You can work with country model directly or access all of them through a Collection class.

```
/**
 * Access through the Collection
 *
 * Consider using the Collection class, if you
 * plan to register it to a service container.
 * It eagerly loads all the countries.
 */
use Omisai\Countries\Collection;

$collection = new Collection();
$countries = $collection->getCountries();

/**
 * Shorthand to use the default english locale
 */
$countries[4]->name; // "Finland"

/**
 * Or using different locale
 */
$countries[4]->getName('fr'); // "Finlande"

/**
 * Search for a specific country based on different criteria
 */
$collection->getCountryByAlpha2('FI'); // Omisai\Countries\Models\Finland
$collection->getCountryByAlpha3('FIN'); // Omisai\Countries\Models\Finland
$collection->getCountryByNumeric('246'); // Omisai\Countries\Models\Finland
$collection->getCountryByFipCode('FI'); // Omisai\Countries\Models\Finland
$collection->getCountryByDial('358'); // Omisai\Countries\Models\Finland
$collection->getCountryByCapital('Helsinki'); // Omisai\Countries\Models\Finland
$collection->getCountryByName('Finland'); // Omisai\Countries\Models\Finland
$collection->getCountryByName('Finlande', "fr"); // Omisai\Countries\Models\Finland

/**
 * Get only a part of data from the countries
 */
$collection->getCountriesAlpha2(); // ['country_name' => 'country_alpha2']
$collection->getCountriesAlpha3(); // ['country_name' => 'country_alpha3']
$collection->getCountriesNumeric(); // ['country_name' => 'country_numeric']
$collection->getCountriesFipCode(); // ['country_name' => 'country_fipCode']
$collection->getCountriesDial(); // ['country_name' => 'country_dial']

$collection->getCountriesAlpha2('fr'); // ['fr:country_name' => 'country_alpha2'] -> ['Finlande' => 'FI']

$collection->getCountriesByContinent('EU'); // [Omisai\Countries\Models\Finland, Omisai\Countries\Models\Hungary, ...]

/**
 * Use any country directly
 */
use Omisai\Countries\Models\Finland;

$europe = new Finland();
$europe->alpha2; // "FI"
$europe->alpha3; // "FIN"
$europe->numeric; // "246"
$europe->fipCode; // "FI"
$europe->dial; // "358"
$europe->capital; // "Helsinki"
$europe->continent; // "EU"
$europe->hu; // "Finnország"
$europe->name; // "Finland"
$europe->getName('it'); // "Finlandia"
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
./vendor/bin/pest

# or

composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project.

Security
--------

[](#security)

Please see [SECURITY.md](.github/SECURITY.md) for details on reporting security vulnerabilities.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

Sponsoring
----------

[](#sponsoring)

If you find this package useful, please consider sponsoring the development: [Sponsoring on GitHub](https://github.com/sponsors/omisai-tech)

Your support helps us maintain and improve this open-source project!

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance82

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.3% 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 ~114 days

Recently: every ~154 days

Total

7

Last Release

94d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/818e031ac6546efe377b692f91166dc1a6c89b8838ce720b8786e4b15a30db62?d=identicon)[bornemisza](/maintainers/bornemisza)

---

Top Contributors

[![bornemisza](https://avatars.githubusercontent.com/u/22169041?v=4)](https://github.com/bornemisza "bornemisza (36 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

countriescountryiso-3166-1phpcountriescountry

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/omisai-php-countries/health.svg)

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

###  Alternatives

[rinvex/countries

Rinvex Countries is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.

1.7k7.4M48](/packages/rinvex-countries)[components/flag-icon-css

A curated collection of all country flags in SVG — plus the CSS for easier integration.

12.0k1.6M23](/packages/components-flag-icon-css)[league/iso3166

ISO 3166-1 PHP Library

70036.3M116](/packages/league-iso3166)[pragmarx/countries

PHP Countries and Currencies

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

Country &amp; state helper for Laravel.

1681.7M](/packages/dougsisk-laravel-country-state)[webpatser/laravel-countries

Modern Laravel Countries package providing ISO 3166-2, ISO 3166-3, currency, capital and more for all countries. Compatible with Laravel 11.x and 12.x.

8272.8M8](/packages/webpatser-laravel-countries)

PHPackages © 2026

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