Ar-PHP

Arabic-aware search, text processing, and presentation toolkit for PHP.

Library
Composer
vv7.0.0
339stars
LGPL-3.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
62/100Good
Development Activity48
Maintenance44
Community76
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
62/100Good
Architecture55
Code Quality60
Innovation70
Learning Curve62

Ar-PHP is a long-running open-source PHP library dedicated to Arabic language processing, giving developers ready-made tools for transliteration, Hijri calendars, spell checking, sentiment analysis, and other Arabic-specific text handling that’s otherwise hard to build from scratch in a mostly English-centric PHP ecosystem.

What You Get

  • Arabic glyph shaping/rendering for correct right-to-left text display
  • Hijri/Gregorian date conversion, Arabic strtotime, and prayer-time/Qibla calculation
  • English-Arabic transliteration, Arabic Soundex, and gender guessing
  • Arabic sentiment analysis, dialect identification, text summarization, and spell checking (SarahSpell)

Common Use Cases

  • Building Arabic-language e-commerce, CMS, or survey sites that need correct RTL text rendering and search
  • Converting between Gregorian and Hijri calendars for religious or regional applications
  • Running lightweight Arabic sentiment analysis or dialect detection on user-generated content
  • Generating Arabic-aware SQL queries and spelling out numbers in the Arabic idiom for invoices/reports

Under The Hood

Architecture - The bulk of functionality lives in a single large src/Arabic.php class (~5,600 lines) exposing one method per feature area (glyphs, dates, transliteration, sentiment, etc.), backed by data tables under src/data/; a separate SarahSpell.php class implements the Arabic spell checker feature. Tech Stack - PHP 5.6+ (PSR-4 autoloaded under ArPHP\I18N), depending on the calendar, mbstring, and zlib PHP extensions, dev-tested with PHPUnit 9; the project also ships a prebuilt .phar archive for non-Composer installs. Code Quality - Covered by tests/ArabicTest.php using PHPUnit; the project has run continuously since 2006 (PHP4 on PHPClasses.org, PHP5 on SourceForge, PHP7/8 on GitHub since 2020) and is adopted by several downstream open-source projects (Bagisto, Akeneo, LimeSurvey, Krayin), indicating real-world validation beyond its own test suite, though the single large class-file design concentrates a lot of surface area in one file. API Design - Nearly all functionality is accessed through instantiating one Arabic object and calling feature-specific methods (e.g. $obj->arabicGlyphs(), $obj->gDate()), which keeps discovery simple via the published API docs but means the class itself is very broad rather than composed of smaller focused collaborators.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search