this is just a wrapper to use with laravel for the Ar-PHP Library, for more details checkout khaled-alshamaa: ar-php
You can install the package via composer:
composer require still-code/ar-php-laravel
dump(ArPhpLaravel::int2str(123)); // مئة و ثلاثة و عشرون
dump(ArPhpLaravel::str2int('مئة و ثلاثة و عشرون')); // 123
dump(ArPhpLaravel::en2ar('google')); // غوغل
dump(ArPhpLaravel::ar2en('خالِد الشَمعَة')); // Khalid Ash-Sham'ah
Check the Gender
dump(ArPhpLaravel::isFemale('محمد')); // false
get the gender as string
dump(ArPhpLaravel::guessGender('محمد')); // Male
dump(ArPhpLaravel::strtotime('الخميس القادم', time(), 'l dS F Y')); // Thursday 13th May 2021
dump(ArPhpLaravel::arSentiment(TEXT));
dump(ArPhpLaravel::standard(TEXT));
dump(ArPhpLaravel::arSummary(TEXT));
dump(ArPhpLaravel::money2str(123, 'SAR', 'ar')); // مئة و ثلاثة و عشرون ريالا
dump(ArPhpLaravel::money2str(123, 'SAR', 'en')); // 123 Riyal
dump(ArPhpLaravel::money2str(123, 'EGP', 'ar')); // مئة و ثلاثة و عشرون جنيها
dump(ArPhpLaravel::int2indic(123)); // ١٢٣
dump(ArPhpLaravel::utf8Glyphs(1229));
dump(ArPhpLaravel::translate('اهلا بالكل')); // Ahla Balkl
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();
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
- write more tests
- add more functions from the main package
- add helpers for the Facade
The MIT License (MIT). Please see License File for more information.