PHP code example of helturkey / php-arabic-support
1. Go to this page and download the library: Download helturkey/php-arabic-support 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/ */
helturkey / php-arabic-support example snippets
use ArabicSupport\Arabic;
use ArabicSupport\Enums\LengthUnit;
Arabic::length('مُ', LengthUnit::Grapheme); // 1 visible character
Arabic::length('مُ', LengthUnit::Unicode); // 2 Unicode code points
Arabic::length('مُ', LengthUnit::Byte); // UTF-8 byte length
use ArabicSupport\Arabic;
use ArabicSupport\Enums\ArabicPolicy;
Arabic::normalize('قائِمةٌ تَجْرِيبيّة على مَنْصّةِ الإدارة', ArabicPolicy::Display);
// قائِمةٌ تَجْرِيبيّة على مَنْصّةِ الإدارة
Arabic::normalize('قائِمةٌ تَجْرِيبيّة على مَنْصّةِ الإدارة', ArabicPolicy::Search);
// قائمه تجريبيه علي منصه الاداره
Arabic::normalize('قائِمةٌ تَجْرِيبيّة على مَنْصّةِ الإدارة', ArabicPolicy::Slug);
// قائمة تجريبية على منصة الإدارة
use ArabicSupport\Arabic;
use ArabicSupport\Enums\LengthUnit;
use ArabicSupport\Enums\SlugMode;
Arabic::unicodeSlug('دليل المستخدم العربي 2026');
// دليل-المستخدم-العربي-2026
Arabic::asciiSlug('دليل المستخدم العربي 2026');
// dlil-almstkhdm-alarby-2026
Arabic::slug('دليل المستخدم العربي 2026', SlugMode::Unicode);
// دليل-المستخدم-العربي-2026
Arabic::sanitize('<b>أَحْمَدُ، مَدْرَسَةٌ؟ iPhone X</b>');
// أَحْمَدُ، مَدْرَسَةٌ؟ iPhone X
Arabic::sanitizeForSearch('<b>أَحْمَدُ، مَدْرَسَةٌ؟ iPhone X</b>');
// احمد مدرسه iphone x
Arabic::safeFilename('تقرير: المبيعات/العام؟.pdf');
// تقرير-المبيعات-العام.pdf
Arabic::limit('مُحَمَّد علي', 5, LengthUnit::Grapheme, '...');
// مُحَ...