定制 deha-soft/jp-string-helper 二次开发

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

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

deha-soft/jp-string-helper

最新稳定版本:v0.0.1

Composer 安装命令:

composer require deha-soft/jp-string-helper

包简介

String helper for japanese

README 文档

README

PHP Japanese string helper functions for converting Japanese strings from full-width to half-width and reverse.
Laravel Rule for validation Japanese string only full-width or only half-width.

Installation

  1. You can install the package via composer:
composer require deha-soft/jp-string-helper
  1. Optional: The service provider will automatically get registered. Or you may manually add the service provider in your config/app.php file:
'providers' => [
    // ...
    DehaSoft\JpStringHelper\JpStrRulesServiceProvider::class,
];

Usage

Example use of the toHalfSize, toFullSize helper.

# using Transform import
use DehaSoft\JpStringHelper\Transform;

$fullSizeStr = "12345ザヂプabcd";
$output = Transform::toHalfSize($fullSizeStr);
echo $output;
>>> 12345ザヂプabcd

$halfSizeStr = "12345ザヂプabcd";
$output = Transform::toFullSize($halfSizeStr);
echo $output;
>>> 12345ザヂプabcd

Example use of the Rule for Laravel validation.

# using Rule class import
use DehaSoft\JpStringHelper\Rules\FullSize;
use DehaSoft\JpStringHelper\Rules\HalfSize;

public function rules()
{
    return [
        'name' => [new FullSize()],
        'description' => [new HalfSize()],
    ];
}
# or using rule alias

public function rules()
{
    return [
        'name' => ['full_size'],
        'description' => ['half_size'],
    ];
}

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 1.15k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 53
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 53
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-15