PHPackages                             etchfoda/laravel-arabic-numbers-middleware - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. etchfoda/laravel-arabic-numbers-middleware

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

etchfoda/laravel-arabic-numbers-middleware
==========================================

auto transforms arabic/eastern to eastern/arabic numbers for i.e ١٢٣٤٥٦٧٨ to 12345678

2.2.0(3y ago)21341MITPHP

Since Oct 4Pushed 3y agoCompare

[ Source](https://github.com/EtchFoda/laravel-arabic-numbers-middleware)[ Packagist](https://packagist.org/packages/etchfoda/laravel-arabic-numbers-middleware)[ Docs](https://github.com/etchfoda/laravel-arabic-numbers-middleware)[ RSS](/packages/etchfoda-laravel-arabic-numbers-middleware/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (4)Versions (11)Used By (0)

Transform between (Arabic-english)/(eastern-Indian) numbers middleware for laravel
==================================================================================

[](#transform-between-arabic-englisheastern-indian-numbers-middleware-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4c95993892484449e0ec33b5704b82a1fc548f94bdc6db39c94c96994aaa73b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79656d656e69667265652f6c61726176656c2d6172616269632d6e756d626572732d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yemenifree/laravel-arabic-numbers-middleware)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/b19732702d361656fbccdca16618cedec4ffac85baf85aea7a9c5da1444f6149/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f79656d656e69667265652f6c61726176656c2d6172616269632d6e756d626572732d6d6964646c65776172652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/yemenifree/laravel-arabic-numbers-middleware)[![StyleCI](https://camo.githubusercontent.com/c8a8f77f8abd1f144c6f3f497d3f84689a0b7f02ccf3a1046d658019144182ea/68747470733a2f2f7374796c6563692e696f2f7265706f732f3130353736333036312f736869656c643f6272616e63683d6d6173746572267374796c653d666c6174)](https://styleci.io/repos/105763061)[![Coverage Status](https://camo.githubusercontent.com/3c8d3ac656ec6f8af67cc57229ecf1a70ce72974dfe0f1262b5c8933fff64fc3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f79656d656e69667265652f6c61726176656c2d6172616269632d6e756d626572732d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/yemenifree/laravel-arabic-numbers-middleware/code-structure)[![Quality Score](https://camo.githubusercontent.com/28a75aeaef43eaa83264f2744a1f70003f2b1e8c9ea6ffceb36516f6cec0b071/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f79656d656e69667265652f6c61726176656c2d6172616269632d6e756d626572732d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/yemenifree/laravel-arabic-numbers-middleware)[![Total Downloads](https://camo.githubusercontent.com/503b2a2002bc40153c28ce6487fce21d42fda487035d8656cdc0bad5b1d6584f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f79656d656e69667265652f6c61726176656c2d6172616269632d6e756d626572732d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yemenifree/laravel-arabic-numbers-middleware)

> A tiny package to transforms [arabic](https://en.wikipedia.org/wiki/Arabic_numerals)/[eastern\*](https://en.wikipedia.org/wiki/Eastern_Arabic_numerals) to [eastern\*](https://en.wikipedia.org/wiki/Eastern_Arabic_numerals)/[arabic](https://en.wikipedia.org/wiki/Arabic_numerals) numbers for i.e `١٢٣٤٥٦٧٨` to `12345678` before validations to avoid invalid integers error when pass `eastern` numbers by (ios/mac) users

- These numbers are known as أرقام هندية ("Indian numbers") in Arabic. They are sometimes also called "Indic numerals" in English. However, that is sometimes discouraged as it can lead to confusion with Indian numerals

Support version
---------------

[](#support-version)

**Laravel****laravel-modules**5.1^1.05.8^2.0Install
-------

[](#install)

Via Composer

```
$ composer require yemenifree/laravel-arabic-numbers-middleware
```

Usage
-----

[](#usage)

If you do not run Laravel 5.5 (or higher), then add the service provider in `config/app.php`:

```
Yemenifree\LaravelArabicNumbersMiddleware\ServiceProvider::class,
```

If you do run the package on Laravel 5.5+, [package auto-discovery](https://medium.com/@taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518) takes care of the magic of adding the service provider.

That's it! by default package automatic transform all `eastern` numbers to `arabic` for all requests

Package includes two middleware

- "eastern-to-arabic" to transform numbers from eastern to arabic (i.e `١٢٣` to `123`)
- "arabic-to-eastern" to transform numbers from arabic to eastern (i.e `123` to `١٢٣`)

You can use middleware for custom router for example

```
Route::any('/login', ['middleware' => 'eastern-to-arabic', function () {
    // your code
}]);
```

you can ignore fields from transform by pass fields name as parameters to middleware for example

```
// ignore transform pass field
Route::any('/login', ['middleware' => 'arabic-to-eastern:pass', function () {
    // your code
}]);

// you can also ignore multi fields
Route::any('/login', ['middleware' => 'arabic-to-eastern:pass,test', function () {
    // your code
}]);
```

> inline ignore fields not work if auto\_register\_middleware enable and middleware you want to use inside auto\_middleware option, instead you can set ignore fields in config file arabic-numbers-middleware.php

Optional
--------

[](#optional)

if you want customizes configuration you can publish the configuration

```
$ php artisan vendor:publish --provider="Yemenifree\LaravelArabicNumbersMiddleware\ServiceProvider"
```

This is the content of the published config file `arabic-numbers-middleware.php`:

```
return [
    /*
     |--------------------------------------------------------------------------
     | enable auto register middleware for all requests
     |--------------------------------------------------------------------------
     |
     | if you want auto register for custom middleware group
     |      'auto_register_middleware' => ['web'], //for web group only
     |      'auto_register_middleware' => true, //  all groups
     |      'auto_register_middleware' => false, // none
     */
    'auto_register_middleware' => true,

    /*
     |--------------------------------------------------------------------------
     | list of middleware they will register for all requests automatic by package
     |--------------------------------------------------------------------------
     |
     |  Supported Middleware: "arabic-to-eastern", "eastern-to-arabic"
     */
    'auto_middleware' => Yemenifree\LaravelArabicNumbersMiddleware\Middleware\TransformHindiToArabicNumbers::class,

    /*
     |--------------------------------------------------------------------------
     | except transform fields ( POST | GET ) from all middleware
     |--------------------------------------------------------------------------
     |
     | all none string value will be ignore by default, you can ignore fields by name (key) of POST or GET
     |
    */
    'except_from_all' => [
        // 'login'
    ],

    /*
     |--------------------------------------------------------------------------
     | except transform fields ( POST | GET ) from eastern to arabic
     |--------------------------------------------------------------------------
     |
     | all none string value will be ignore by default, you can ignore fields by name (key) of POST or GET
     |
     */
    'except_from_eastern_to_arabic' => [
        // 'mobile'
    ],

    /*
     |--------------------------------------------------------------------------
     | except transform fields ( POST | GET ) from arabic to eastern
     |--------------------------------------------------------------------------
     |
     | all none string value will be ignore by default, you can ignore fields by name (key) of POST or GET
     |
     */
    'except_from_arabic_to_eastern' => [
        // 'mobile'
    ]
];
```

Change log
----------

[](#change-log)

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

Testing
-------

[](#testing)

```
$ composer test
```

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

[](#contributing)

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

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Salah Alkhwlani](https://github.com/yemenifree)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 64% 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 ~238 days

Recently: every ~225 days

Total

9

Last Release

1287d ago

Major Versions

1.0.0 → 2.0.02019-06-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/1da9c7b76693fd6dff979ebcc864d67ea9e92fee6051a65b03959695da520331?d=identicon)[etchfoda](/maintainers/etchfoda)

---

Top Contributors

[![salkhwlani](https://avatars.githubusercontent.com/u/10876587?v=4)](https://github.com/salkhwlani "salkhwlani (16 commits)")[![hesham-fouda](https://avatars.githubusercontent.com/u/15731469?v=4)](https://github.com/hesham-fouda "hesham-fouda (5 commits)")[![aldawliksa](https://avatars.githubusercontent.com/u/71778602?v=4)](https://github.com/aldawliksa "aldawliksa (3 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

middlewarelaravelnumbersarabicarabic-numbersyemenifreelaravel-arabic-numbers-middlewareeastern numbersenglish numbersIndian numbers

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/etchfoda-laravel-arabic-numbers-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/etchfoda-laravel-arabic-numbers-middleware/health.svg)](https://phpackages.com/packages/etchfoda-laravel-arabic-numbers-middleware)
```

###  Alternatives

[yemenifree/laravel-arabic-numbers-middleware

auto transforms arabic/eastern to eastern/arabic numbers for i.e ١٢٣٤٥٦٧٨ to 12345678

18135.7k](/packages/yemenifree-laravel-arabic-numbers-middleware)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k12.5k1](/packages/vinkius-labs-laravel-page-speed)[emargareten/inertia-modal

Inertia Modal is a Laravel package that lets you implement backend-driven modal dialogs for Inertia apps.

90142.9k](/packages/emargareten-inertia-modal)[still-code/ar-php-laravel

ar-php-laravel

398.5k](/packages/still-code-ar-php-laravel)

PHPackages © 2026

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