writecrow/country_code_converter
最新稳定版本:1.3.0
Composer 安装命令:
composer require writecrow/country_code_converter
包简介
Convert country name to codes or vice-versa.
README 文档
README
A PHP library for converting ISO country codes to names and vice-versa.
Country data was last updated on August 10, 2017, from https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements
The library recognizes ISO 2-digit, 3-digit, and numeric codes.
Usage in an application
The included /demo/index.php file contains a generation form demo.
Make your code aware of the CountryCodeConverter class via your favorite method
(e.g., use or require)
Then pass a country code or country name into the class:
echo CountryCodeConverter::convert('AL'); // Will print 'Albania' echo CountryCodeConverter::convert('ALB'); // Will print 'Albania' echo CountryCodeConverter::convert('008'); // Will print 'Albania' echo CountryCodeConverter::convert('Albania'); // Will print 'AL'
Explicitly requesting return format.
If you want a specific format returned, pass the desired format as a second parameter:
echo CountryCodeConverter::convert('Albania', 'name'); // Will print 'Albania' echo CountryCodeConverter::convert('Albania', 'two-digit'); // Will print 'AL' echo CountryCodeConverter::convert('Albania', 'three-digit'); // Will print 'ALB' echo CountryCodeConverter::convert('Albania', 'numeric'); // Will print '008'
统计信息
- 总下载量: 91.09k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-08-11