still-code/ar-php-laravel

ar-php-laravel
9,057 39
Install
composer require still-code/ar-php-laravel
Latest Version:3.0.0
PHP:^8.2
License:MIT
Last Updated:Jun 22, 2026
Links: GitHub  ·  Packagist
Maintainer: atmonshi

laravel package for the Ar-PHP Project

this is just a wrapper to use with laravel for the Ar-PHP Library, for more details checkout khaled-alshamaa: ar-php

Installation

You can install the package via composer:

composer require still-code/ar-php-laravel

Available functions

Spell Numbers in the Arabic Idiom
dump(ArPhpLaravel::int2str(123)); // مئة و ثلاثة و عشرون
dump(ArPhpLaravel::str2int('مئة و ثلاثة و عشرون')); // 123
English-Arabic Transliteration
dump(ArPhpLaravel::en2ar('google')); // غوغل
dump(ArPhpLaravel::ar2en('خالِد الشَمعَة')); // Khalid Ash-Sham'ah
Arabic Gender Guesser

Check the Gender

dump(ArPhpLaravel::isFemale('محمد')); // false

get the gender as string

dump(ArPhpLaravel::guessGender('محمد')); // Male
Parse any Arabic textual datetime description into timestamp
dump(ArPhpLaravel::strtotime('الخميس القادم', time(), 'l dS F Y')); // Thursday 13th May 2021
Arabic Sentiment Analysis
dump(ArPhpLaravel::arSentiment(TEXT));
Arabic Text Standardize
dump(ArPhpLaravel::standard(TEXT));
Arabic Auto Summarize
dump(ArPhpLaravel::arSummary(TEXT));
Convert Money to string
dump(ArPhpLaravel::money2str(123, 'SAR', 'ar')); // مئة و ثلاثة و عشرون ريالا
dump(ArPhpLaravel::money2str(123, 'SAR', 'en')); // 123 Riyal
dump(ArPhpLaravel::money2str(123, 'EGP', 'ar')); // مئة و ثلاثة و عشرون جنيها
Spell Numbers in the Arabic Idiom
dump(ArPhpLaravel::int2indic(123)); // ١٢٣
Arabic Glyphs to Render Arabic Text
dump(ArPhpLaravel::utf8Glyphs(1229));
translate arabic text to english, useful for slug generating
dump(ArPhpLaravel::translate('اهلا بالكل')); // Ahla Balkl

Search with Eloquent and query Builder

Using search for arabic letters with Eloquent Builder

Model::searchAr('فلسطين','content')->get();

you can use the same with Query Builder:

DB::table('table_name')->searchAr('فلسطين','content')->get();

you can set the search mode OR (default) or AND

DB::table('table_name')->searchAr('فلسطين','content','OR')->get();

and it will find result for any of the words:

فلسطينيون فلسطيني فلسطينية فلسطينيتين فلسطينيين فلسطينيان فلسطينيات فلسطينيوا

you can also sort the results by using:

DB::table('table_name')->orderAr('فلسطين','content')->get();

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

Todo

  • write more tests
  • add more functions from the main package
  • add helpers for the Facade

License

The MIT License (MIT). Please see License File for more information.

Related Packages

ab-alselwi/laravel-arabic-html

Convert laravel view to arabic html (pdf) by using ArPHP and dompdf with arabic...

37,737 35
abdullahobaid/arabicnumbers

A package to fix arabic numbers input

17,600 10
islamalsayed/laravel-toasts

Modern, elegant toast notifications and confirmation dialogs for Laravel with fu...

28 0
yasser-elgammal/pure-text

A Laravel package for filtering and replacing inappropriate or unwanted words wi...

145 11

Version History

Version Released PHP Laravel License
3.0.0 ^8.2 ^11.0|^12.0|^13.0 MIT
2.0.4 ^7.1|^8.0|^8.1|^8.2 ^8.0|^9.0|^10.0|^11.0|^12.0 MIT
2.0.3 ^7.1|^8.0|^8.1|^8.2 ^8.0|^9.0|^10.0|^11.0 MIT
2.0.2 ^7.1|^8.0|^8.1|^8.2 ^8.0|^9.0|^10.0 MIT
2.0.1 ^7.1|^8.0|^8.1 ^8.0|^9.0|^10.0 MIT