daniel-km/simple-iso-3166-1
Composer 安装命令:
composer require daniel-km/simple-iso-3166-1
包简介
Convert two and three letters countries codes and names with iso 3166-1.
关键字:
README 文档
README
Simple ISO 3166-1 is a small library to convert country codes ISO 3166-1 (two and three letters country codes) and native, English and French names. It is built from the official standard lists ISO 3166-1.
This library is used in the module Bulk Import for Omeka S and some other places.
The list of codes may be updated by ISO, so some codes may be removed and some other ones may be added regularly.
Installation
This module is a composer library available on [packagist]:
composer require daniel-km/simple-iso-3166-1
Usage
Once included in your code via composer or with require_once 'path/to/vendor/daniel-km/simple-iso-3166-1/src/Iso3166p1.php;',
you can use it like that:
$countries = [
'fr',
'fra',
'France',
'Germany',
'Deutschland',
'fxxx',
];
$result = [];
foreach ($countries as $country) {
$result[$country] = [
'country' => $country,
'code' => \Iso3166p1\Iso3166p1::code($country),
'short' => \Iso3166p1\Iso3166p1::code2letters($country),
'numeric' => \Iso3166p1\Iso3166p1::numerical($country),
'all' => \Iso3166p1\Iso3166p1::codes($country),
'native' => \Iso3166p1\Iso3166p1::name($country),
'English name' => \Iso3166p1\Iso3166p1::englishName($country),
'French name' => \Iso3166p1\Iso3166p1::frenchName($country),
];
}
print_r($result);
Result:
| country | code | short | numeric | all | native | English name | French name |
|---|---|---|---|---|---|---|---|
| fr | FRA | FR | 250 | FR, FRA, 250 | France | France | France |
| fra | FRA | FR | 250 | FR, FRA, 250 | France | France | France |
| France | FRA | FR | 250 | FR, FRA, 250 | France | France | France |
| Germany | DEU | DE | 276 | DE, DEU, 276 | Deutschland | Germany | Allemagne |
| Deutschland | DEU | DE | 276 | DE, DEU, 276 | Deutschland | Germany | Allemagne |
| fxxx |
Development
The lists are automatically generated from this command:
php -f scripts/generate.php
Warning
Use it at your own risk.
It’s always recommended to backup your files and your databases and to check your archives regularly so you can roll back if needed.
Troubleshooting
See online issues page on GitLab.
License
Module
This module is published under the CeCILL v2.1 license, compatible with GNU/GPL and approved by FSF and OSI.
This software is governed by the CeCILL license under French law and abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software’s author, the holder of the economic rights, and the successive licensors have only limited liability.
In this respect, the user’s attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software’s suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions as regards security.
The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms.
Copyright
- Copyright https://www.iso.org (country codes)
- Copyright Daniel Berthereau, 2023 (see Daniel-KM on GitLab)
daniel-km/simple-iso-3166-1 适用场景与选型建议
daniel-km/simple-iso-3166-1 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 609 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 05 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ISO 3166」 「country code」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 daniel-km/simple-iso-3166-1 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 daniel-km/simple-iso-3166-1 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 daniel-km/simple-iso-3166-1 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Provides some value objects.
Sun Country is the package that helps you to get the country name & dialing code by the country ISO 3166-1 Alpha-2 code.
List of all countries with names and ISO 3166-1 codes in all languages and data formats for Laravel
Country select field type.
Add generic 'geo-zones' a full list of country specific regions and the ability to categorise them into zones
PHP Library for ZIP codes
统计信息
- 总下载量: 609
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: CECILL-2.1
- 更新时间: 2023-05-22