Code Monkey home page Code Monkey logo

ar-php-laravel's Introduction

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.

ar-php-laravel's People

Contributors

atmonshi avatar ayaseensd avatar dependabot[bot] avatar github-actions[bot] avatar goodm4ven avatar koossaayy avatar smailancer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ar-php-laravel's Issues

Laravel search only specific word

Hi ,
I have a database with arabic records now i want to search exact word like Words that include
شَهْر
But excluding
شَهْرَيْنِ

Words that include
سَنَة
And
سِنِين
Laravel approach
Verse::where('text','like','%'.$string.'%')->get()
Your Package
Verse::searchAr('text',$string)->get();

your package also giving same result , i mean search for all similar words which contain شَهْر but i want to search where word is only شَهْر
any soultion or suggestion

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.