jinas/iso-3166

使用ISO 3166-1 alpha-2,ISO 3166-1 alpha-3和ISO 3166-1数字查找信息

v1.0 2020-05-22 12:38 UTC

This package is auto-updated.

Last update: 2024-09-29 05:42:41 UTC


README

Build Status StyleCI

一个用于通过ISO 3166-1 alpha-2,ISO 3166-1 alpha-3和ISO 3166-1数字查找信息的库

安装

composer require jinas/iso-3166

用法

通过ISO 3166-1 Alpha-2获取国家

use Jinas\ISO\ISO3166;

$iso = new ISO3166;
var_dump($iso->whereAlpha2('no'));

/* Returns:
  {
    country: 'Norway',
    alpha2: 'NO',
    alpha3: 'NOR',
    numeric: '578'
  }
*/

通过ISO 3166-1 Alpha-3获取国家

use Jinas\ISO\ISO3166;

$iso = new ISO3166;
var_dump($iso->whereAlpha3('nor'));
/* Returns:
  {
    country: 'Norway',
    alpha2: 'NO',
    alpha3: 'NOR',
    numeric: '578'
  }
*/

通过ISO 3166-1数字获取国家

use Jinas\ISO\ISO3166;

$iso = new ISO3166;
var_dump($iso->whereNumeric(578));
/* Returns:
  {
    country: 'Norway',
    alpha2: 'NO',
    alpha3: 'NOR',
    numeric: '578'
  }
*/

通过国家名称获取值

use Jinas\ISO\ISO3166;

$iso = new ISO3166;
var_dump($iso->whereCountry("norway"));

/* Returns:
  {
    country: 'Norway',
    alpha2: 'NO',
    alpha3: 'NOR',
    numeric: '578'
  }
*/

许可证

MIT © Mohamed Jinas