sameer-shelavale/php-countries-array
Composer 安装命令:
composer require sameer-shelavale/php-countries-array
包简介
PHP class to get array of countries names with ISO_3166-1 alpha-2, alpha-3, numeric codes, ISD codes and continent
关键字:
README 文档
README
PHP class to get array of countries with ISO_3166-1, ISO_3166-2 and ISD codes it can provide following information related to the country
- name - Name of the country
- alpha2 - alpha2 code, 2 characters (ISO-3166-1 alpha2)
- alpha3 - alpha3 code, 3 characters (ISO-3166-1 alpha3)
- num - numeric code (ISO-3166-1 numeric)
- isd - ISD code for country
- continent - Name of the continent in which the country is present
##Installation
PHP Include
Include CountryArray.php in your php code and you its ready to use.
Composer:
Add the package to your composer.json and run composer update.
{
"require": {
"sameer-shelavale/php-countries-array": "*"
}
}
##Usage
Get simple key-value array by default it returns alpha2 => name pairs
$countries = CountriesArray::get();
Include non iso countries:
$countries = CountriesArray::iso(false)->get();
Get key values pairs
$countries = CountriesArray::get( 'alpha2', 'name' ); // returns alpha2->name array
$countries = CountriesArray::get( 'num', 'alpha3' ); // return numeric-codes->alpha3 array
$countries = CountriesArray::get( 'num', 'name' ); // return numeric-codes->name array
Get only values without keys
$countries = CountriesArray::get( null, 'name' ); // return array of country names
$countries = CountriesArray::get( null, 'alpha2' ); // return array of alpha2 codes
Get 2d array
$countries = CountriesArray::get2d( null, 'name' ); // return array of country names
$countries = CountriesArray::get2d( null, 'alpha2' ); // return array of alpha2 codes
Get countries filtered by continent
$countries = CountriesArray::getFromContinent( 'alpha2', 'name', 'Africa' ); // returns alpha2->name array of countries from Africa
$countries = CountriesArray::getFromContinent( 'num', 'alpha3', 'Asia' ); // return numeric-codes->alpha3 array of countries from Asia
$countries = CountriesArray::getFromContinent( 'num', 'name', 'Europe' ); // return numeric-codes->name array of countries from Europe
##IMP Note Do not use ISD code(isd) and continent as key fields, as there are multiple records for them
sameer-shelavale/php-countries-array 适用场景与选型建议
sameer-shelavale/php-countries-array 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 427.63k 次下载、GitHub Stars 达 33, 最近一次更新时间为 2014 年 12 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「continent」 「PHP countries array」 「countries array」 「ISO_3166-1」 「alpha-2」 「alpha-3」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sameer-shelavale/php-countries-array 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sameer-shelavale/php-countries-array 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sameer-shelavale/php-countries-array 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, ISO 4217 currencies (symbols & numeric codes), native name, phone. JSON, CSV and SQL.
List of all countries with names and ISO 3166-1 codes in all languages and data formats for Laravel
Laravel 5.2 package that provides basic geographical data like Countries, Regions and Cities.
GeoLocation package for Laravel.
Intl extension data in comfortable format.
Country data for Yii2 using Intl extension and more.
统计信息
- 总下载量: 427.63k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 34
- 点击次数: 26
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2014-12-15