alzpk / restcountries-eu-api
This package is abandoned and no longer maintained.
The author suggests using the alzpk/restcountries-php-api-wrapper package instead.
Restcountries.eu API PHP wrapper
2.0.0
2021-09-16 17:36 UTC
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.