PHPackages                             phpuef/country - 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. phpuef/country

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

phpuef/country
==============

v1.0.1(1y ago)20MITPHPCI passing

Since May 18Pushed 2w ago1 watchersCompare

[ Source](https://github.com/phpuef/country)[ Packagist](https://packagist.org/packages/phpuef/country)[ RSS](/packages/phpuef-country/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (9)Versions (6)Used By (0)

[![](docs/gouef_logo.png)](docs/gouef_logo.png)

Country
=======

[](#country)

This package provides functions to search for country information ([ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html)) based on their country codes (Alpha-2, Alpha-3, Numeric) and names. It is designed for easy integration into applications that need to work with country codes or names.

[![Static Badge](https://camo.githubusercontent.com/eadad9fa972d87af8cc921c369134bb3c84a8da7f12f4fb679ff273e22126938/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769746875622d706870756566253246636f756e7472792d626c75653f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c696e6b3d6769746875622e636f6d253246706870756566253246636f756e747279)](https://github.com/phpuef/country)

[![Packagist Downloads](https://camo.githubusercontent.com/03dd8495e486c524aa4e2f43fa8f904135720b01688f3e05e46581640a7465d0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068707565662f636f756e747279)](https://packagist.org/packages/phpuef/country)[![GitHub stars](https://camo.githubusercontent.com/6635cc07c501f64ac240644664dc9e86190500273f3b6885d0bca70dc6d7d127/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f7068707565662f636f756e7472793f7374796c653d736f6369616c)](https://github.com/phpuef/country/stargazers)[![PHPStan](https://github.com/phpuef/country/actions/workflows/phpstan.yml/badge.svg)](https://github.com/phpuef/country/actions/workflows/phpstan.yml/badge.svg)[![Tests](https://github.com/phpuef/country/actions/workflows/tests.yml/badge.svg)](https://github.com/phpuef/country/actions/workflows/tests.yml)[![codecov](https://camo.githubusercontent.com/4a98801fefd44607b009e0be5dd1b13c33ad47f16cc65b474c451399a563b8c7/68747470733a2f2f636f6465636f762e696f2f6769746875622f7068707565662f636f756e7472792f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d59554738454d48365138)](https://codecov.io/github/phpuef/country)

Versions
--------

[](#versions)

[![Stable Version](https://camo.githubusercontent.com/1df07c16560e23856e0df32ce1f7733608dc77c931ad754e2861b8d313a69336/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7068707565662f636f756e7472793f6c6162656c3d537461626c65266c6162656c436f6c6f723d677265656e)](https://camo.githubusercontent.com/1df07c16560e23856e0df32ce1f7733608dc77c931ad754e2861b8d313a69336/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7068707565662f636f756e7472793f6c6162656c3d537461626c65266c6162656c436f6c6f723d677265656e)[![GitHub Release](https://camo.githubusercontent.com/9b9c39e3fa859c7576058cb5b60fca3a0a91bbbcde8d328bcca0c295184570cd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7068707565662f636f756e7472793f6c6162656c3d524326696e636c7564655f70726572656c65617365732666696c7465723d2a72632a266c6f676f53697a653d646961676f)](https://camo.githubusercontent.com/9b9c39e3fa859c7576058cb5b60fca3a0a91bbbcde8d328bcca0c295184570cd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7068707565662f636f756e7472793f6c6162656c3d524326696e636c7564655f70726572656c65617365732666696c7465723d2a72632a266c6f676f53697a653d646961676f)[![GitHub Release](https://camo.githubusercontent.com/186b5b58927984372e1a4731c8654faac4f65e857ddaa2d56dee218cb8fbd64d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7068707565662f636f756e7472793f6c6162656c3d4265746126696e636c7564655f70726572656c65617365732666696c7465723d2a626574612a266c6f676f53697a653d646961676f)](https://camo.githubusercontent.com/186b5b58927984372e1a4731c8654faac4f65e857ddaa2d56dee218cb8fbd64d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7068707565662f636f756e7472793f6c6162656c3d4265746126696e636c7564655f70726572656c65617365732666696c7465723d2a626574612a266c6f676f53697a653d646961676f)

Also available in other languages
---------------------------------

[](#also-available-in-other-languages)

[![Go Implementation](https://camo.githubusercontent.com/f4ec64cd758546ca2793d3a63b385934f9edc620bee02aff087d00bf61c1834d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f476f2d636f756e7472792d3030414444383f6c6f676f3d476f266c6f676f436f6c6f723d7768697465)](https://github.com/gouef/country)[![PHP Implementation](https://camo.githubusercontent.com/e1339f752b66a3c0f449bae47973341fb3750ba3ca480c7db5f24b71da39a838/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d636f756e7472792d3446354439353f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://github.com/phpuef/country)

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

[](#installation)

```
  composer require phpuef/country
```

Usage
-----

[](#usage)

`Country` **Class**Each country is represented by the `Country` class, which contains the following fields:

- `name`: The country's name (in English).
- `alpha2`: The two-letter country code (ISO 3166-1 alpha-2).
- `alpha3`: The three-letter country code (ISO 3166-1 alpha-3).
- `numeric`: The numeric country code (ISO 3166-1 numeric).

Functions
---------

[](#functions)

`FindByAlpha2(string $alpha2): ?Country`

This function searches for a country by its two-letter Alpha-2 code.

```
