thalidzhokov/country-codes
Composer 安装命令:
composer require thalidzhokov/country-codes
包简介
CountryCodes PHP Class to get array of countries with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3, ISO 3166-1 numeric and ISD codes it can provide following information related to country
关键字:
README 文档
README
CountryCodes PHP Class to get array of countries with ISO 3166-1 alpha-2, ISO 3166-1 alpha-3, ISO 3166-1 numeric and ISD codes it can provide following information related to country
- alpha2 ISO-3166-1 alpha-2 https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
- alpha3 ISO-3166-1 alpha-3 https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
- numeric ISO-3166-1 numeric https://en.wikipedia.org/wiki/ISO_3166-1_numeric
- isd Internatiguonal Subscriber Dialing code https://en.wikipedia.org/wiki/List_of_country_calling_codes
- continentCode Continent Code
- continent Continent Name
- country Country Name
- countryFull Country Full Name
- emoji Emoji Flag http://unicode.org/emoji/charts/emoji-ordering.html#country-flag
Installation
Install via Composer
composer require thalidzhokov/country-codes
OR include CountryCodes.php in your PHP code
require_once('CountryCodes.php');
Usage
Change default language
\CountryCodes::$language = 'ru';
Method get()
Get array key => value
\CountryCodes::get('alpha2', 'country');
Return
array (
'AB' => 'Abkhazia',
'AD' => 'Andorra',
...,
'AI' => 'Anguilla',
'AL' => 'Albania',
'AM' => 'Armenia',
...,
'US' => 'USA',
...
)
Method get2()
Get array with multiple values key => [value1, value2, ...]
\CountryCodes::get2('alpha3', ['alpha2', 'continentCode', 'emoji']);
Return
array (
'ABH' =>
array (
'alpha2' => 'AB',
'continentCode' => 'AS',
'emoji' => '',
),
'AND' =>
array (
'alpha2' => 'AD',
'continentCode' => 'EU',
'emoji' => '🇦🇩',
),
'ARE' =>
array (
'alpha2' => 'AE',
'continentCode' => 'AS',
'emoji' => '🇦🇪',
),
...
)
Method getByContinent()
Get array key => value by continent
\CountryCodes::getByContinent('alpha3', 'countryFull', 'EU');
Return
array (
...,
'BEL' => 'Belgium',
'BGR' => 'Bulgaria',
'BLR' => 'Belarus',
'CHE' => 'Swiss Confederation',
'CZE' => 'Czech Republic',
'DEU' => 'Germany',
...
)
Method getEmojiByAlpha2()
Get emoji flag code by alpha2
\CountryCodes::getEmojiByAlpha2('ZW');
Return
🇿🇼
Method getEmojiByAlpha3()
Get emoji flag code by aplha3
\CountryCodes::getEmojiByAlpha3('ZMB');
Return
🇿🇲
thalidzhokov/country-codes 适用场景与选型建议
thalidzhokov/country-codes 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 115.74k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2017 年 10 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「iso」 「3166」 「numeric」 「country codes」 「alpha-2」 「alpha-3」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 thalidzhokov/country-codes 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 thalidzhokov/country-codes 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 thalidzhokov/country-codes 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Provides some value objects.
Add generic 'geo-zones' a full list of country specific regions and the ability to categorise them into zones
PHP Library for ZIP codes
Immutable numeric value object with chainable arithmetic operations and Laravel Number formatting
Symfony 2 integration for BcMath wrapper
An objectifier for primitive numeric data types.
统计信息
- 总下载量: 115.74k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 35
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2017-10-25