alldigitalrewards / country-mapper
Country Mapper Library
Installs: 3 004
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- php: ^7.0|^8.0
- ext-json: *
- guzzlehttp/guzzle: ^6.5|^7.0
- league/iso3166: ~2.1.5|^3.0|^4.0
Requires (Dev)
- phpunit/phpunit: ^7.0|^8|^9
- roave/security-advisories: dev-latest
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2024-11-02 17:14:41 UTC
README
This is a Country mapper which maps a Country Alpha or Numeric code
Install
Via Composer
$ composer require alldigitalrewards/country-mapper
Usage
These calls throw CountryMapperException **Get Whitelisted Iso**: $iso = (new CountryInputMapperService())->getWhitelistedIso(840); $this->assertSame('840', $iso); **Get Whitelisted Alpha2**: $alpha = (new CountryInputMapperService())->getWhitelistedAlpha2('US'); $this->assertSame('US', $alpha); **Get Country by Input (accepts iso/alpha2)**: $country = (new CountryInputMapperService())->getMappedCountry('840'); $this->assertInstanceOf(Country::class, $country); $this->assertSame('US', $country->getAlpha2()); $this->assertSame('840', $country->getNumeric());
Testing
$ composer test