alzpk / restcountries-php-api-wrapper
Restcountries.com API PHP wrapper
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/alzpk/restcountries-php-api-wrapper
Requires
- php: ^7.4|^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.4
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-10-25 23:11:21 UTC
README
Requirements
{
"php": "^7.4|^8.0",
"guzzlehttp/guzzle": "^7.4",
"ext-json": "*"
}
Installation
composer require alzpk/restcountries-php-api-wrapper
Usage examples
$client = new \Alzpk\RestCountriesPhpApiWrapper\RestCountriesClient(); // Fetch all countries $countries = $client->all(); // Fetch countries by searching names $countries = $client->searchByName('Denmark');
Client Map
| Method | Params | Example |
|---|---|---|
| all | $client->all(); |
|
| searchByName | (string) Country name | $client->searchByName('Denmark'); |
| searchByCode | (string) Country code | $client->searchByCode('208'); |
| searchByCodes | (array) List of country codes | $client->searchByCodes(['208', '209']); |
| searchByCurrency | (string) Country currency | $client->searchByCurrency('DKK'); |
| searchByLanguage | (string) Country language | $client->searchByLanguage('da'); |
| searchByCapital | (string) Country capital | $client->searchByCapital('Copenhagen'); |
| searchByRegion | (string) Country region | $client->searchByRegion('Europe'); |
| searchBySubregion | (string) Country subregion | $client->searchBySubregion('South'); |
More info
Check https://github.com/amatosg/restcountries for more info.