zvermafia/transliteration
Composer 安装命令:
composer require zvermafia/transliteration
包简介
Uzbek latin <=> cyrillic transliterator
README 文档
README
Uzbek latin <=> cyrillic transliterator. Under the hood it uses some online transliteration services. But it's extendable!
Navigation by sections
- Install
- Usage
- Make your own implementation (extending)
- Change log
- Testing
- Contributing
- Security
- Credits
- License
Install
Via Composer
$ composer require zvermafia/uzbek-transliterator
Usage
Out of the box there are two implementations for your choice:
Zvermafia\Transliteration\AlifTransliteratorwhich uses an alif.uz online transliteration service's API;Zvermafia\Transliteration\LotinTransliteratorwhich uses a lotin.uz online transliteration service's API;
Also you can implement your own class which will use another service's API or won't use any services' API and does all the job by itself.
require __DIR__ . "/vendor/autoload.php"; // Initialize the object $transliterator = new Zvermafia\Transliteration\AlifTransliterator(); // or you can use LotinTransliterator $transliterator->setText("Salom, dunyo!") ->toCyrillic() ->translit(); echo $transliterator->getResult(); // it will output: Салом, дунё!
Make your own implementation (extending)
If these two already exist implementations aren't enough for you, then you can extend functionalities of this package by implementing your own transliterator class. If so there are three possible ways:
- Create a class by implementing a
Zvermafia\Transliteration\Interfaces\TransliteratorInterfaceinterface. In this case you must realize all the methods defined in the interface from scratch by yourself; - This is the recommended way (if you're not going to use third party APIs with HTTP). Create a class by extending
Zvermafia\Transliteration\Abstracts\TransliteratorAbstractabstract class. In this case you must realize only that methods which aren't already realized by the abstract class. The abstract class already realized common methods of the interface; - This one is similar to the previous way. Because in this case you'll use a
Zvermafia\Transliteration\Abstracts\HttpTransliteratorAbstractabstract class which is extends by theZvermafia\Transliteration\Abstracts\TransliteratorAbstract. But what is the difference? The difference is in this abstract class realized some common methods which will work with the HTTP through the cURL extension. So you must only configure some specific HTTP request parameters to work with an API.
So here are examples by the points.
An example for the point number 1:
<?php namespace Whatever\Namespace; use Zvermafia\Transliteration\Interfaces\TransliteratorInterface; // point #1 class MyTransliterator implements TransliteratorInterface { // realize all the methods defined in the interface ( }
An example for the point number 2:
<?php namespace Whatever\Namespace; use Zvermafia\Transliteration\Abstracts\TransliteratorAbstract; use Zvermafia\Transliteration\Interfaces\TransliteratorInterface; // point #1 class MyTransliterator extends TransliteratorAbstract { public function translit(): : TransliteratorInterface { $text = $this->getText(); // $result = ... // here translit the text $this->setResult($result); return $this; } }
An example for the point number 3:
As examples for this point you can see source codes of Zvermafia\Transliteration\AlifTransliterator and Zvermafia\Transliteration\LotinTransliterator.
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email mohirjon@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
zvermafia/transliteration 适用场景与选型建议
zvermafia/transliteration 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「package」 「api」 「library」 「transliterator」 「uzbek」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 zvermafia/transliteration 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 zvermafia/transliteration 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 zvermafia/transliteration 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Inbox pattern process implementation for your Laravel Applications
Simple ASCII output of array data
Core library that defines common interfaces used by the rest of the intahwebz..
Amqp classes
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 16
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-18