定制 mohammad-zarifiyan/laravel-string-kit 二次开发

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

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

mohammad-zarifiyan/laravel-string-kit

Composer 安装命令:

composer require mohammad-zarifiyan/laravel-string-kit

包简介

Extends Laravel's Str and Stringable classes with additional string utilities.

README 文档

README

Laravel String Kit extends Laravel's Str and Stringable classes with additional string utilities.

Currently, the package provides methods for detecting text direction and converting Unicode decimal digits from any supported writing system to ASCII digits.

All methods are also available on Laravel's Stringable class.

Installation

Install the package via Composer:

composer require mohammad-zarifiyan/laravel-string-kit:^1.0

Usage

textDirection()

Determines the writing direction of a string.

The method ignores whitespace, punctuation, and digits before detecting the writing direction.

use Illuminate\Support\Str;

Str::textDirection('Hello World');

Result:

'ltr'
use Illuminate\Support\Str;

Str::textDirection('سلام دنیا');

Result:

'rtl'

If the string contains only digits, punctuation, or whitespace, the method returns:

'ltr'

If the writing direction cannot be determined, the method returns:

null

replaceDigitsWithAscii()

Converts Unicode decimal digits from any supported writing system to ASCII digits.

use Illuminate\Support\Str;

Str::replaceDigitsWithAscii('سال ۲۰۲۶');

Result:

'سال 2026'

Another example:

use Illuminate\Support\Str;

Str::replaceDigitsWithAscii('१२३٤۵6');

Result:

'123456'

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2026-06-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固