worthwelle/alphonic
Composer 安装命令:
composer require worthwelle/alphonic
包简介
A library for converting strings into and from phonetic spellings for use over the phone, a radio or other unclear communications channels. Alphonic provides these conversions not only using the standard NATO alphabet, but also various other phonetic alphabets, making it perfect for easily convertin
关键字:
README 文档
README
A library for converting strings into and from phonetic spellings for use over the phone, a radio or other unclear communications channels. Alphonic provides these conversions not only using the standard NATO alphabet, but also various other phonetic alphabets, making it perfect for easily converting strings with historical accuracy.
Important note
The alphabets in this library are provided not only as-is, but also as-were. That is, these alphabets are provided as they were originally defined. This means that the characters supported by each alphabet differ. Some alphabets cover only the classical Latin alphabet, some include numbers, some include language-specific Latin characters (such as the various letters with diacritical marks), and some include punctuation and figure-specific characters.
These limitations can be overcome using the add_symbol function, which allows adding characters to a particular alphabet on a one-time-only basis. To fill in only missing symbols in multiple alphabets, the add_symbol or add_symbols functions can be used with $overwrite set to false. This will, naturally, be a non-standard use of the alphabet.
More information on creating custom alphabets will be available in the near future.
Installation
Library
git clone https://github.com/worthwelle/alphonic.git
Composer
composer require worthwelle/alphonic
Usage
Load pre-configured alphabets
<?php $alphonic = new Alphonic(); $alphonic->load_alphabets(); $alphonic->alphabet("NATO")->add_symbol(" ","|"); $alphonic->alphabet("NATO")->add_symbol(",","Comma"); $alphonic->alphabet("NATO")->add_symbol("!","Exclamation"); echo $output = $alphonic->phonetify("Holy alphabets, Batman!", "NATO"); // Hotel Oscar Lima Yankee | Alfa Lima Papa Hotel Alfa Bravo Echo Tango Sierra Comma | Bravo Alfa Tango Mike Alfa November Exclamation echo $alphonic->unphonetify($output, "NATO"); // HOLY ALPHABETS, BATMAN!
Load a custom alphabet
<?php $alphonic = new Alphonic(); $alphonic->load_alphabet_from_file('myalphabet.json'); $alphonic->load_alphabet_from_json(file_get_contents('myotheralphabet.json'); // The second argument allows Alphonic to skip alphabets that don't pass validation. // This defaults to false. $alphonic2 = new Alphonic('directory/full/of/alphabets', true);
Configuration Options
Known Issues
- Localizations are currently not supported and alphabets require titles and symbols utilizing the "en" localization.
- During early development the JSON schema is likely to change without notice. Once v1.0 is formalized, this will become the standard going forward.
Running the tests
composer test # run all unit tests composer test-timing # report the runtime of each test into an XML file composer coverage # run unit tests and report code coverage composer coverage-report # run unit tests and provide a thorough code coverage report composer testOnly TestClass # run specific unit test class composer testOnly TestClass::testMethod # run specific unit test method composer style-check # check code style for errors composer style-fix # automatically fix code style errors
Contributing
Alphabets
Currently supported alphabets:
| Code | Alphabet Title |
|---|---|
APCO1941 |
Association of Public-Safety Communications Officials-International (1941) |
APCO1967 |
Association of Public-Safety Communications Officials-International Project 2 (1967) |
APCO1974 |
Association of Public-Safety Communications Officials-International Project 14 (1974) |
ARRL1936 |
American Radio Relay League (1936) |
CCBUSUK1943 |
Combined Communications Board (1943) |
CCIR-ICAN1932 |
General Radiocommunication and Additional Regulations (CCIR/ICAN, 1932) |
CCIR1927 |
General Radiotelegraph Regulations (1927) |
ICAO1946 |
ICAO Second Session of the Communications Division (1946) |
IRC1947 |
Radio Regulations and Additional Radio Regulations (Atlantic City, 1947) |
IRCC1938 |
International Radiocommunication Conference (Cairo, 1938) |
LVMPD |
Las Vegas Metropolitan Police Department |
NATO |
NATO Phonetic Alphabet |
NATO1956 |
NATO Phonetic Alphabet (Jan 1 - Feb 29, 1956) |
UECU1920 |
Universal Electrical Communications Union (1920) |
USAFM2412-1943 |
U.S. Army Field Manual 24-12 (1943-1955) |
USAFM245-1939 |
U.S. Army Field Manual 24-5 (1939-1943) |
USAFM245-1941 |
U.S. Army Field Manual 24-5 (1941-1943) |
USAS1919 |
U.S. Air Service (1919) |
USASB1916 |
U.S. Army Signal Book (1916-1939) |
USJAN1941 |
U.S. Joint Army/Navy (1941-1943) |
USJAN1941A |
U.S. Joint Army/Navy variant (1941-1943) |
USN1908-1 |
U.S. Navy (1908; Version 1) |
USN1908-2 |
U.S. Navy (1908; Version 2) |
USN1913 |
U.S. Navy (1913-1926) |
USN1927 |
U.S. Navy (1927-1937) |
USN1938 |
U.S. Navy (1938) |
USNWW2 |
U.S. Navy World War II |
WU1918 |
Western Union (1918) |
worthwelle/alphonic 适用场景与选型建议
worthwelle/alphonic 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 01 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「generator」 「dictionary」 「tool」 「encode」 「decode」 「phonetic」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 worthwelle/alphonic 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 worthwelle/alphonic 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 worthwelle/alphonic 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
Simple, immutable data structures
Backend Google Sign On for Magento 2
An app setting manager tool for laravel nova
Dictionary implementation for PHP
Tresholds Governor, aims to facilitate the protection of authentication against brute force and dictionary attacks
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2020-01-02