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
其他信息
- 授权协议: Unknown
- 更新时间: 2026-06-29