one23/iso639
Composer 安装命令:
composer require one23/iso639
包简介
PHP library to convert ISO-639
README 文档
README
PHP library to convert ISO-639 code
Installation
composer require one23/iso639
Data source
- en.wikipedia.org: ISO 639-1 : iso-639-old.csv (deprecate)
- en.wikipedia.org: List of ISO 639-1 codes : iso-639-1.csv
- en.wikipedia.org: ISO 639-2 : iso-639-2-group.csv
- en.wikipedia.org: List of ISO 639-3 language codes : iso-639-3-name.csv
- en.wikipedia.org: ISO 639 macrolanguage : iso-639-3.csv
- en.wikipedia.org: List of ISO 639-5 codes : iso-639-5.csv
- en.wikipedia.org: List of ISO 639-6 codes : iso-639-6.csv
- iso639-3.sil.org: ISO 639-3 Downloads : iso-639-3-macrolanguages_20220311.csv, iso-639-3_20220311.csv, iso-639-3_name_index_20220311.csv, iso-639-3_retirements_20220311.csv
Update date: 2022-11-23
How to
use \One23\Iso639\Code1; use \One23\Iso639\Code2b; use \One23\Iso639\Code2t; use \One23\Iso639\Code3; // or //use \One23\Iso639\Code3Min as Code3; (string)Code1::from('en')->code3(); // => 'eng' (string)Code1::from('uk')->getNameNative(); // => 'українська мова' (string)Code1::from('jv')->getName(); // => 'Javanese' (string)Code2t::from('eng')->getName(); // => 'English' (string)Code2t::from('ind')->getNameNative(); // => 'Bahasa Indonesia' (string)Code2t::from('jav')->code1(); // => 'jv'
Use
Code1 && Code2b && Code2t
Static methods
- from(string $code): Code3
- all(): string[]
Methods
- getCode(): string
- getName(): ?string
- getNameNative(): ?string
- getNotes(): ?string
- getFamily(): ?string
- isMacrolanguage(): bool
- isAncient(): bool
- macrolanguages(): Code3Macro[]
- code1(): ?Code1
- code2t(): ?Code2t
- code2b(): ?Code2b
- code3(): ?Code3
- toString(): string - alias getCode()
- toArray(): array{iso_639_1_code: string, iso_639_1_name: ?string, iso_639_1_native: ?string, iso_639_1_notes: ?string, iso_639_2_t_code: ?string, iso_639_2_t_name: ?string, iso_639_2_b_code: ?string, iso_639_2_b_name: ?string, iso_639_3_code: ?string, iso_639_5_code: ?Code3, iso_639_5_name: ?string, iso_639_6_code: ?string}
use \One23\Iso639\Code1 as Code; // or //use \One23\Iso639\Code2b as Code; // or //use \One23\Iso639\Code2t as Code; $code = Code::from('en'); (string)$code; // => 'en' // or $code->getCode(); // => 'en' // or $code->toString(); // => 'en' $code->getName(); // => 'English' $code->toArray(); // => "{"iso_639_1_code":"en","iso_639_1_name":"English","iso_639_1_native":"English","iso_639_1_notes":null,"iso_639_1_family":"Indo-European","is_ancient":false,"is_macrolanguage":false,"macrolanguages":[],"iso_639_2_t_code":"eng","iso_639_2_t_name":"English","iso_639_2_b_code":"eng","iso_639_2_b_name":"English","iso_639_3_code":"eng","iso_639_6_code":"engs"} $code1 = Code2b::from('ara')->code1(); $macrolanguages = $code1->macrolanguages(); array_keys($macrolanguages); // => ["aao","abh","abv","acm","acq",...] reset($macrolanguages); // Code3Macro Code1::all(); // => ["ab","aa","af","ak",...] Code2b::all(); // => ["abk","aar","afr","aka","alb","amh",...] Code2t::all(); // => ["abk","aar","afr","aka","sqi","amh","ara","arg",...]
Code3 && Code3All && Code3Min (only with 639-1)
Static methods
- from(string $code): Code3
- all(): string[]
Methods
- getCode(): string
- getName(): ?string
- getNameInverted(): ?string
- getScope(): ?string
- getType(): ?string
- getNotes(): ?string
- code1(): ?Code1
- code2t(): ?Code2t
- code2b(): ?Code2b
- code3(): ?Code3
- merge(): ?Code3
- toString(): string - alias getCode()
- toArray(): array{iso_639_3_code: string, iso_639_3_name: ?string, iso_639_3_name_inverted: ?string, iso_639_3_scope: ?string, iso_639_3_type: ?string, iso_639_3_notes: ?string, iso_639_1_code: ?string, iso_639_2_b_code: ?string, iso_639_2_t_code: ?string, iso_639_3_merge: ?Code3, iso_639_3_merge_reason: ?string, iso_639_3_merge_date: ?string}
use \One23\Iso639\Code3; // or //use \One23\Iso639\Code3All as Code3; $code3 = Code3::from('ful'); (string)$code3; // => 'ful' // or $code3->getCode(); // => 'ful' // or $code3->toString(); // => 'ful' $code3->getName(); // => 'Fulah' $code3->toArray(); // => {"iso_639_3_code":"ful","iso_639_3_name":"Fulah","iso_639_3_name_inverted":"Fulah","iso_639_3_scope":"M","iso_639_3_type":"L","iso_639_3_notes":null,"iso_639_1_code":"ff","iso_639_2_b_code":"ful","iso_639_2_t_code":"ful","iso_639_3_merge":null,"iso_639_3_merge_reason":null,"iso_639_3_merge_date":null} $code3 = Code3All::from('xrq'); /** @var Code3All|null $merge **/ $merge = $code3->merge() if ($merge) { $merge->toArray(); // => {"iso_639_3_code":"dmw","iso_639_3_name":"Mudburra","iso_639_3_name_inverted":"Mudburra","iso_639_3_scope":"I","iso_639_3_type":"L","iso_639_3_notes":null,"iso_639_1_code":null,"iso_639_2_b_code":null,"iso_639_2_t_code":null,"iso_639_3_merge":null,"iso_639_3_merge_reason":null,"iso_639_3_merge_date":null} } Code3::all(); // => ["aka","ara","aym","aze","bal",...]
Code3Macro
Static methods
- from(string $code): Code3
- all(): string[]
Methods
- getCode(): string
- getName(): ?string
- getStatus(): ?string
- code1(): ?Code1
- code2t(): ?Code2t
- code2b(): ?Code2b
- code3(): ?Code3
- alias(): ?Code3Macro
- toString(): string - alias getCode()
- toArray(): array{macrolanguage_code: string, macrolanguage_name: ?string, macrolanguage_status: string, macrolanguage_alias: ?string, iso_639_3_code: ?string}
use \One23\Iso639\Code3Macro; $code3Macro = Code3Macro::from('pmu'); (string)$code3Macro; // => 'pmu' // or $code3Macro->getCode(); // => 'pmu' // or $code3Macro->toString(); // => 'pmu' $code3Macro->getName(); // => 'Mirpur Panjabi' $code3Macro->toArray(); // => {"macrolanguage_code":"pmu","macrolanguage_name":"Mirpur Panjabi","macrolanguage_status":"R","macrolanguage_alias":"phr","iso_639_3_code":"lah"} /** @var Code3Macro|null $parent **/ $alias = $code3Macro->alias() if ($alias) { $alias->toArray(); // => {"macrolanguage_code":"phr","macrolanguage_name":"Pahari-Potwari","macrolanguage_status":"A","macrolanguage_alias":null,"iso_639_3_code":"lah"} } Code3Macro::all(); // => ["fat","twi","aao","abh","abv","acm",...]
Code5
Static methods
- from(string $code): Code5
- all(): string[]
Methods
- getCode(): string
- getName(): ?string
- getNotes(): ?string
- parent(): ?Code5
- code1(): ?Code1
- code2t(): ?Code2t
- code3(): ?Code3
- toString(): string - alias getCode()
- toArray(): array{iso_639_5_code: string, iso_639_5_name: ?string, iso_639_5_notes: ?string, parent: ?string, iso_639_2_t_code: ?string, iso_639_2_b_code: ?string}
use \One23\Iso639\Code5; $code5 = Code5::from('alg'); (string)$code5; // => 'alg' // or $code5->getCode(); // => 'alg' // or $code5->toString(); // => 'alg' $code5->getName(); // => 'Algonquian languages' $code5->toArray(); // => {"iso_639_5_code":"alg","iso_639_5_name":"Algonquian languages","iso_639_5_notes":null,"iso_639_5_parent":"aql","iso_639_2_t_code":"alg","iso_639_2_b_code":null} /** @var Code5|null $parent **/ $parent = $code5->parent() if ($parent) { $parent->toArray(); // => {"iso_639_5_code":"aql","iso_639_5_name":"Algic languages","iso_639_5_notes":null,"iso_639_5_parent":"nai","iso_639_2_t_code":null,"iso_639_2_b_code":null} } Code5::all(); // => ["aav","afa","alg","alv","apa",...] $code5 = Code5::from('aav'); $code5->getNotes(); // => 'South-Asiatic languages, not related to Australian languages'
Code6
Static methods
- from(string $code): Code5
- all(): string[]
Methods
- getCode(): string
- getName(): ?string
- toString(): string - alias getCode()
- toArray(): array{iso_639_6_code: string, iso_639_6_name: ?string}
use \One23\Iso639\Code6; $code6 = Code6::from('tjin'); (string)$code6; // => 'tjin' // or $code6->getCode(); // => 'tjin' // or $code6->toString(); // => 'tjin' $code6->getName(); // => 'Tianjin' $code6->toArray(); // => {"iso_639_6_code":"tjin","iso_639_6_name":"Tianjin"} Code6::all(); // => ["ango","bicr","bjgh","bjjg",...]
Security
If you discover any security related issues, please email eugene@krivoruchko.info instead of using the issue tracker.
License
one23/iso639 适用场景与选型建议
one23/iso639 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 46 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 11 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「language」 「iso」 「lang」 「iso-639」 「639」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 one23/iso639 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 one23/iso639 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 one23/iso639 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Easy to use i18n translation PHP class for multi-language websites
Laravel Localization in JavaScript
Package for convenient work with Laravel's localization features
Store your language lines in the database, yaml or other sources
Set Links with a specific language parameter
统计信息
- 总下载量: 46
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-26