定制 mdaliyan/farsi-request 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mdaliyan/farsi-request

最新稳定版本:v1.1.3-stable

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

Build Status License

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

  1. Replaces Arabic characters with farsi standard characters

  2. 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">

统计信息

  • 总下载量: 759
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固