mohammad-zarifiyan/laravel-string-kit

There is no license information available for the latest version (1.0.0) of this package.

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

Maintainers

Package info

github.com/MohammadZarifiyan/Laravel-String-Kit

pkg:composer/mohammad-zarifiyan/laravel-string-kit

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-06-27 14:21 UTC

This package is auto-updated.

Last update: 2026-06-29 08:49:35 UTC


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'