PHP code example of goodm4ven / arabicable

1. Go to this page and download the library: Download goodm4ven/arabicable library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

goodm4ven / arabicable example snippets


   use Illuminate\Database\Schema\Blueprint;
   use Illuminate\Support\Facades\Schema;

   Schema::create('notes', function (Blueprint $table): void {
       $table->id();
       $table->arabicText('content');
       $table->timestamps();
   });
   

   use GoodMaven\Arabicable\Traits\Arabicable;
   use Illuminate\Database\Eloquent\Model;

   class Note extends Model
   {
       use Arabicable;

       protected $fillable = ['content'];
   }
   

$table->arabicText('content', isTranslatable: true);

Post::query()
    ->searchArabic('content', $query)
    ->limit(20)
    ->get();

use GoodMaven\Arabicable\Facades\Arabic;
use GoodMaven\Arabicable\Facades\ArabicFilter;

$searchable = ArabicFilter::forSearch($text);
$stemmed = ArabicFilter::forStem($text);
$withoutHarakat = ArabicFilter::withoutHarakat($text);
$clean = Arabic::stripWeirdCharacters($text, keepHarakat: true, keepPunctuation: true);
$keywords = Arabic::extractKeywords($text);
$plan = Arabic::buildComprehensiveSearchPlan($query);
$variants = Arabic::expandWordVariants($tokens, mode: 'all', stripStopWords: true);

'features' => [
    'quran' => true,
],

use GoodMaven\Arabicable\Facades\Arabic;

$hijri = Arabic::gregorianToHijri(2025, 1, 1); // ['year' => ..., 'month' => ..., 'day' => ...]
$gregorian = Arabic::hijriToGregorian($hijri['year'], $hijri['month'], $hijri['day']);

'quran_fonts' => [
    'surah_headers' => [
        'preferred' => 'qcf-surah-header-color-regular',
        'available' => [
            'qcf-surah-header-color-regular' => [
                'family' => 'QcfSurahHeaderColor',
                'filename' => 'QCF_SurahHeader_COLOR-Regular.woff2',
                'format' => 'woff2',
            ],
            'surah-name-v2' => [
                'family' => 'SurahNameV2',
                'filename' => 'surah-name-v2.woff2',
                'format' => 'woff2',
            ],
        ],
    ],
],
bash
php artisan arabicable:install --seed
bash
php artisan vendor:publish --tag=arabicable-assets
bash
php artisan vendor:publish --tag="arabicable-config" --force
php artisan vendor:publish --tag="arabicable-migrations" --force
php artisan vendor:publish --tag="arabicable-raw-data" --force
php artisan migrate
bash
php artisan vendor:publish --tag=arabicable-assets --force
php artisan vendor:publish --tag=arabicable-raw-data --force
bash
php artisan arabicable:seed --all
php artisan arabicable:seed --common-texts --stop-words
php artisan arabicable:seed --all --truncate