PHPackages                             ariaieboy/laravel-persian-helpers - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. ariaieboy/laravel-persian-helpers

ActiveLibrary[Localization &amp; i18n](/categories/localization)

ariaieboy/laravel-persian-helpers
=================================

Add more functionality for Persian language into Laravel

2.2.0(4w ago)11.5kMITPHPPHP ~8.4|~8.5

Since Dec 19Pushed 4w ago1 watchersCompare

[ Source](https://github.com/ariaieboy/laravel-persian-helpers)[ Packagist](https://packagist.org/packages/ariaieboy/laravel-persian-helpers)[ Docs](https://github.com/ariaieboy/laravel-persian-helpers)[ GitHub Sponsors](https://github.com/Ariaieboy)[ RSS](/packages/ariaieboy-laravel-persian-helpers/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (5)Dependencies (26)Versions (7)Used By (0)

Add more functionality for Persian language into Laravel
========================================================

[](#add-more-functionality-for-persian-language-into-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/960eb8f1631ec23b4bee8b11e3d138ea9ec5a62ee88ec5e4df634ac5b72b9f44/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617269616965626f792f6c61726176656c2d7065727369616e2d68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ariaieboy/laravel-persian-helpers)[![GitHub Tests Action Status](https://camo.githubusercontent.com/30346d432ee2ed0e1e2280bbfb6c36546d4fb147bdf5eeafb97bd4b9b1dcba36/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f617269616965626f792f6c61726176656c2d7065727369616e2d68656c706572732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/ariaieboy/laravel-persian-helpers/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/37c3786137c8af8caf12cbaee42b412382e18777d15a0843a1848093283fe7c0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f617269616965626f792f6c61726176656c2d7065727369616e2d68656c706572732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/ariaieboy/laravel-persian-helpers/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/fe5e07ca91b7c44fe7939f4fd40d1383aaf2d6c37701aa0888331b351caada43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f617269616965626f792f6c61726176656c2d7065727369616e2d68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ariaieboy/laravel-persian-helpers)

This package will add some helpers and macros to the laravel that help you work with persian language and convert non persian character and digits to persian or vise-versa.

Requirement
-----------

[](#requirement)

This package requires php version &gt;= `8.4` and laravel version &gt;= `12`

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require ariaieboy/laravel-persian-helpers
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-persian-helpers-config"
```

Usage
-----

[](#usage)

### Facade

[](#facade)

```
    PersianHelpers::toEnglishDigit('۱۲۳۴'); // will return "1234"

    PersianHelpers::toPersianDigit('1234٥٤'); // will return "۱۲۳۴۵۴"

    PersianHelpers::toPersianLetter(',;كإأؤةۀي?'); // will return "،؛کااوههی؟"

    PersianHelpers::toPersian('12ي'); // will return "۱۲ی"
```

### `Str` macros

[](#str-macros)

```
    Str::toEnglishDigit('۱۲۳۴'); // will return "1234"

    Str::toPersianDigit('1234٥٤'); // will return "۱۲۳۴۵۴"

    Str::toPersianLetter(',;كإأؤةۀي?'); // will return "،؛کااوههی؟"

    Str::toPersian('12ي'); // will return "۱۲ی"
```

### Middlewares

[](#middlewares)

By using these middlewares all the user inputs will be converted to correct format.

```
use Ariaieboy\LaravelPersianHelpers\Http\Middleware\ToEnglishDigit;
use Ariaieboy\LaravelPersianHelpers\Http\Middleware\ToPersianDigit;
use Ariaieboy\LaravelPersianHelpers\Http\Middleware\ToPersianLetter;
use Ariaieboy\LaravelPersianHelpers\Http\Middleware\ToPersian;
Route::post('example1')->middleware(ToEnglishDigit::class);
Route::post('example2')->middleware(ToPersianDigit::class);
Route::post('example3')->middleware(ToPersianLetter::class);
Route::post('example4')->middleware(ToPersian::class);
```

> Note: by default `current_password`,`password` and `password_confirmation` inputs are ignored and are not affected by this middleware to customize this behavior you should extend each of this middleware and change the `$except` property of the middleware

```
class MyCustomToEnglishDigitMiddleware extends \Ariaieboy\LaravelPersianHelpers\Http\Middleware\ToEnglishDigit{
    /**
    * @var array
    */
    protected array $except = [
    'title',
    'password'
];
}

Route::post('example')->middleware(MyCustomToEnglishDigitMiddleware::class);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [AriaieBOY](https://github.com/ariaieboy)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance94

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~131 days

Total

5

Last Release

28d ago

Major Versions

1.0.0 → 2.0.02024-12-29

PHP version history (2 changes)1.0.0PHP ~8.4

2.1.1PHP ~8.4|~8.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15873972?v=4)[AriaieBOY](/maintainers/ariaieboy)[@ariaieboy](https://github.com/ariaieboy)

---

Top Contributors

[![ariaieboy](https://avatars.githubusercontent.com/u/15873972?v=4)](https://github.com/ariaieboy "ariaieboy (34 commits)")

---

Tags

laravelariaieboylaravel-persian-helpers

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ariaieboy-laravel-persian-helpers/health.svg)

```
[![Health](https://phpackages.com/badges/ariaieboy-laravel-persian-helpers/health.svg)](https://phpackages.com/packages/ariaieboy-laravel-persian-helpers)
```

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.3M42](/packages/spatie-laravel-pdf)[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M153](/packages/spatie-laravel-health)[askdkc/breezejp

Laravel Starter Kit (Livewire+Breeze+Laravel UI+Jetstream)や標準のバリデーションメッセージを全て一瞬で日本語化し、言語切替機能も提供するパッケージです / This package provides all-in-one Japanese translation for Laravel StarterKit (Livewire StarterKit, Breeze, Laravel UI and Jetstream) packages and validation messages with language switching feature.

593266.8k1](/packages/askdkc-breezejp)[spatie/laravel-passkeys

Use passkeys in your Laravel app

470755.5k32](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)[elegantly/laravel-translator

All on one translations management for Laravel

6326.3k](/packages/elegantly-laravel-translator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
