PHPackages                             namnv609/php-rest-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. [API Development](/categories/api)
4. /
5. namnv609/php-rest-countries

ActiveLibrary[API Development](/categories/api)

namnv609/php-rest-countries
===========================

PHP API client for RestCountries.EU

v1.0.0(8y ago)226.5k↓16.7%3[1 PRs](https://github.com/namnv609/php-rest-countries/pulls)MITPHPPHP &gt;=5.5

Since Jul 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/namnv609/php-rest-countries)[ Packagist](https://packagist.org/packages/namnv609/php-rest-countries)[ RSS](/packages/namnv609-php-rest-countries/feed)WikiDiscussions develop Synced 1mo ago

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

PHP RestCountries
=================

[](#php-restcountries)

> Get information about countries via a RESTful API

System requirements
-------------------

[](#system-requirements)

- **PHP &gt;= 5.5**

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

[](#installation)

Using Composer

- `composer require namnv609/php-rest-countries`

or you can include the following in your `composer.json`

- `"namnv609/php-rest-countries": "^1.0.0"`

Usage instructions
------------------

[](#usage-instructions)

First, create new `RestCountries` instance to make configuring the library for use:

```
use NNV\RestCountries;

$restCountries = new RestCountries;
```

Once the `RestCountries` instance has been registered. You may use it like so:

### [All](https://restcountries.eu/#api-endpoints-all)

[](#all)

```
$restCountries->all();
```

### [Name](https://restcountries.eu/#api-endpoints-name)

[](#name)

> Search by country name. It can be the native name or partial name or full name

```
$restCountries->byName("viet");

// or with full name
$restCountries->byName("vietnam", true);
```

### [Code(s)](https://restcountries.eu/#api-endpoints-code)

[](#codes)

> Search by ISO 3166-1 2-letter or 3-letter country code(s)

```
// Single country code
$restCountries->byCodes("vn");

// Multiple country codes
$restCountries->byCodes(["vn", "cn", "th"]);
```

### [Currency](https://restcountries.eu/#api-endpoints-currency)

[](#currency)

> Search by ISO 4217 currency code

```
$restCountries->byCurrency("vnd");
```

### [Language](https://restcountries.eu/#api-endpoints-language)

[](#language)

> Search by ISO 639-1 language code.

```
$restCountries->byLanguage("vi");
```

### [Capital city](https://restcountries.eu/#api-endpoints-capital-city)

[](#capital-city)

> Search by capital city

```
$restCountries->byCapitalCity("hanoi");
```

### [Calling code](https://restcountries.eu/#api-endpoints-calling-code)

[](#calling-code)

> Search by calling code

```
$restCountries->byCallingCode("84");
```

### [Region](https://restcountries.eu/#api-endpoints-region)

[](#region)

> Search by region: Africa, Americas, Asia, Europe, Oceania

```
$restCountries->byRegion("asia");
```

### [Regional bloc](https://restcountries.eu/#api-endpoints-regional-bloc)

[](#regional-bloc)

> Search by regional bloc:
>
> - EU (European Union)
> - EFTA (European Free Trade Association)
> - CARICOM (Caribbean Community)
> - PA (Pacific Alliance)
> - AU (African Union)
> - USAN (Union of South American Nations)
> - EEU (Eurasian Economic Union)
> - AL (Arab League)
> - ASEAN (Association of Southeast Asian Nations)
> - CAIS (Central American Integration System)
> - CEFTA (Central European Free Trade Agreement)
> - NAFTA (North American Free Trade Agreement)
> - SAARC (South Asian Association for Regional Cooperation)

```
$restCountries->byRegionalBloc("asean");
```

### Filter response

[](#filter-response)

> You can filter the output of your request to include only the specified fields.

```
// You can use `fields([])` with any available methods

$restCountries->fields(["name", "callingCodes", "capital"])->all();

$restCountries->fields(["name"])->byName("vietnam", true);

$restCountries->fields(["callingCodes"])->byRegionalBloc("asean");
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

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

3230d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

countriesRESTful APIrest countriesrestcountries.eu

### Embed Badge

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

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[igaster/laravel_cities

Seed all countries/cities from geonames.org database. Searchable DB tree, ready to use API &amp; a bonus vue.js component!

17988.7k1](/packages/igaster-laravel-cities)[obiefy/api-response

Simple Laravel package to return Json responses.

17324.6k](/packages/obiefy-api-response)[beecloud.cn/rest

BeeCloud RESTful API FOR PHP

547.8k1](/packages/beecloudcn-rest)

PHPackages © 2026

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