Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boring-dragon/iso-3166
Lookup information with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3 and ISO 3166-1 numeric
https://github.com/boring-dragon/iso-3166
country iso-3166 iso-3166-1 php
Last synced: about 2 months ago
JSON representation
Lookup information with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3 and ISO 3166-1 numeric
- Host: GitHub
- URL: https://github.com/boring-dragon/iso-3166
- Owner: boring-dragon
- Created: 2020-05-22T12:39:01.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-28T19:47:25.000Z (over 4 years ago)
- Last Synced: 2024-11-29T18:53:48.880Z (about 2 months ago)
- Topics: country, iso-3166, iso-3166-1, php
- Language: PHP
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# iso-3166
[![Build Status](https://travis-ci.org/jinas123/iso-3166.svg?branch=master)](https://travis-ci.org/jinas123/iso-3166)
[![StyleCI](https://github.styleci.io/repos/266107255/shield?branch=master)](https://github.styleci.io/repos/266107255?branch=master)> Library to lookup information with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3 and ISO 3166-1 numeric
### Installation
```bash
composer require jinas/iso-3166
```### Usage
Get country by ISO 3166-1 Alpha-2
```php
use Jinas\ISO\ISO3166;$iso = new ISO3166;
var_dump($iso->whereAlpha2('no'));/* Returns:
{
country: 'Norway',
alpha2: 'NO',
alpha3: 'NOR',
numeric: '578'
}
*/
```Get country by ISO 3166-1 Alpha-3
```php
use Jinas\ISO\ISO3166;$iso = new ISO3166;
var_dump($iso->whereAlpha3('nor'));
/* Returns:
{
country: 'Norway',
alpha2: 'NO',
alpha3: 'NOR',
numeric: '578'
}
*/
```Get country by ISO 3166-1 Numeric
```php
use Jinas\ISO\ISO3166;$iso = new ISO3166;
var_dump($iso->whereNumeric(578));
/* Returns:
{
country: 'Norway',
alpha2: 'NO',
alpha3: 'NOR',
numeric: '578'
}
*/
```Get values by country name
```php
use Jinas\ISO\ISO3166;$iso = new ISO3166;
var_dump($iso->whereCountry("norway"));/* Returns:
{
country: 'Norway',
alpha2: 'NO',
alpha3: 'NOR',
numeric: '578'
}
*/
```### License
MIT © [Mohamed Jinas](https://jinas.me)