atm-code/ar-php-laravel

This package is abandoned and no longer maintained. The author suggests using the https://github.com/still-code/ar-php-laravel package instead.

ar-php-laravel

Fund package maintenance!
atmonshi

2.0.3 2024-04-02 18:34 UTC

README

68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c25323041722d5048502e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d7374696c6c2d636f646525324661722d7068702d6c61726176656c267061747465726e3d627269636b57616c6c267374796c653d7374796c655f31266465736372697074696f6e3d41722d5048502b777261707065722b666f722b6c61726176656c266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313235707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667

68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7374696c6c2d636f64652f61722d7068702d6c61726176656c 68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7374696c6c2d636f64652f61722d7068702d6c61726176656c 68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f7374696c6c2d636f64652f61722d7068702d6c61726176656c 68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7374696c6c2d636f64652f61722d7068702d6c61726176656c2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265 badge.svg

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();

Used By

This project is used by the following companies:

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.