mdaliyan/farsi-request
Composer 安装命令:
composer require mdaliyan/farsi-request
包简介
A (Laravel Request Transformer) that replaces Arabic characters with Farsi characters, and auto-converts numbers in parameters that you want.
README 文档
README
Farsi Request replaces arabic characters like ي ك ة ٤ ٥ ٦ with Farsi characters like ی ک ه ۴ ۵ ۶ in all your requests parameters automatically.
If you are building a farsi website you might end up having some users who use Arabic keyboard. These users may cause problems to your content or experience some confusion while searching among your content.
Tested
farsi-request is tested on laravel 5.x && 6.x
Features
-
Replaces Arabic characters with farsi standard characters
-
Automatically Converts Farsi or English Numbers to each other in your desired request parameters to one another. For example:
- Product names, like R2D2 should never have farsi numbers, right?
- user's phone number
Install
$ composer require mdaliyan/farsi-request
Usage
1. Auto-Replace arabic characters
Add this middleware to your kernel file app/Http/Kernel.php
protected $middleware = [ ... \Mdaliyan\FarsiRequest\Middleware\ReplaceArabicCharacters::class, ];
2. Auto-Replace numbers in request parameters
Add this trait and two private properties to your Request Class. Then add the parameters that should have farsi or english numbers to the desired property.
use Mdaliyan\FarsiRequest\Traits\ReplaceNumbers; class SomeRequest extends FormRequest { use ReplaceNumbers; private $mustHaveEnglishNumbers = ['id','email','phone_number']; private $mustHaveFarsiNumbers = ['post_content','author_name']; /** * Determine if the user is authorized to make this request. * @return bool */ public function authorize() { return true; } ...
Note: this feature ignores numbers inside HTML tags:
This line with the numbers 889 and an image: <img src="/media/media2.jpg"> <!-- will be converted to: --> This line with the numbers ۸۸۹ and an image: <img src="/media/media2.jpg">
mdaliyan/farsi-request 适用场景与选型建议
mdaliyan/farsi-request 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 773 次下载、GitHub Stars 达 11, 最近一次更新时间为 2016 年 10 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「request」 「laravel」 「persian」 「farsi」 「characters」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mdaliyan/farsi-request 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mdaliyan/farsi-request 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mdaliyan/farsi-request 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
HTTP request logger middleware for Laravel
Adds request-parameter validation to the SLIM 3.x PHP framework
A simple HTTP application builder using PSR-15 HTTP Server Request Handler and Middleware.
Marussia request
Alfabank REST API integration
Request parameter manager to easily access request parameters.
统计信息
- 总下载量: 773
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-10-23