alzpk / restcountries-eu-api
Restcountries.eu API PHP wrapper
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 2
pkg:composer/alzpk/restcountries-eu-api
Requires
- php: ^7.4
- ext-json: *
- guzzlehttp/guzzle: 7.4.x-dev
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2022-06-21 20:56:21 UTC
README
Package is abandoned
Use this instead: https://packagist.org/packages/alzpk/restcountries-php-api-wrapper
PHP wrapper for Restcountries.eu API
PHP wrapper for restcountries.eu API, that returns a model with value objects, based on the response from the API.
Requirements
{
"php": "^7.4",
"guzzlehttp/guzzle": "7.4.2",
"ext-json": "*"
}
Installation
composer require alzpk/restcountries-eu-api
Usage examples
$client = new \Alzpk\RestCountriesEuAPI\RestCountriesClient(); // Fetch all countries $countries = $client->all(); // Fetch countries by searching names $countries = $client->name('Denmark');
Client Map
| Method | Params | Example |
|---|---|---|
| all | $client->all(); |
|
| name | (string) Country name | $client->name('Denmark'); |
| code | (string) Country code | $client->code('208'); |
| codes | (array) List of country codes | $client->codes(['208', '209']); |
| currency | (string) Country currency | $client->curency('DKK'); |
| language | (string) Country language | $client->language('da'); |
| callingCode | (string) Country calling code | $client->callingCode('45'); |
| region | (string) Country region | $client->region('Europe'); |
| regionalBloc | (string) Country regional block | $client->regionalBloc('EU'); |
Testing
The package comes with individual tests for models, value objects and wrapper.