PHPackages                             yemenifree/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. yemenifree/laravel-arabic-numbers-middleware

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

yemenifree/laravel-arabic-numbers-middleware
============================================

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

4.0.1(3y ago)18135.4k11[1 issues](https://github.com/salkhwlani/laravel-arabic-numbers-middleware/issues)MITPHPPHP ^8.0

Since Oct 4Pushed 3y ago3 watchersCompare

[ Source](https://github.com/salkhwlani/laravel-arabic-numbers-middleware)[ Packagist](https://packagist.org/packages/yemenifree/laravel-arabic-numbers-middleware)[ Docs](https://github.com/yemenifree/laravel-arabic-numbers-middleware)[ RSS](/packages/yemenifree-laravel-arabic-numbers-middleware/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (7)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.06.X^2.18.X^3.09.X^4.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

41

—

FairBetter than 89% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 79.2% 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 ~383 days

Recently: every ~328 days

Total

6

Last Release

1223d ago

Major Versions

1.0.0 → 2.0.02019-06-03

2.1.0 → 3.0.02021-06-09

3.0.0 → 4.0.02023-01-01

PHP version history (2 changes)1.0.0PHP ~5.6|~7.0

4.0.1PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/60036767b6c53b6c4266f7b46348b93b505cf278203df5d7c06d5f7661d1fcc3?d=identicon)[salahalkhwlani](/maintainers/salahalkhwlani)

---

Top Contributors

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

---

Tags

arabicenglishindian-numberslaravelmiddlewaresnumbersmiddlewarelaravelnumbersarabicarabic-numbersyemenifreelaravel-arabic-numbers-middlewareeastern numbersenglish numbersIndian numbers

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[timacdonald/has-parameters

A trait that allows you to pass arguments to Laravel middleware in a more PHP'ish way.

228271.7k2](/packages/timacdonald-has-parameters)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[maherelgamil/arabicdatetime

Easy and useful tool to generate arabic or hijri date with multi-language support for laravel

414.5k](/packages/maherelgamil-arabicdatetime)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)

PHPackages © 2026

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